Cognizant
100+ V2soft Interview Questions and Answers
Q1. 2.What programming language are you proficient with..?
I am proficient in multiple programming languages including Java, Python, and C++.
Proficient in Java, Python, and C++
Experience with web development languages such as HTML, CSS, and JavaScript
Familiarity with scripting languages like Bash and PowerShell
Knowledge of database languages like SQL and NoSQL
Comfortable with object-oriented programming and design patterns
Q2. two puzzles: 1. how can you cut a cake in 8 pieces in minimum number of cuts(answered) ,2.make 4 equilateral triangles using 6 matchsticks(answered)
1. Cut cake in 8 pieces in minimum cuts. 2. Make 4 equilateral triangles using 6 matchsticks.
1. Cut cake in half horizontally and vertically. Cut each quarter diagonally.
2. Use 3 matchsticks to form a triangle. Use the other 3 to connect the centers of each triangle.
Both puzzles require creative thinking and problem-solving skills.
Q3. 1. Project description 2. Technologies used in recent project 3. What is dependency injection 4. Difference between Rest and Soap 5. Difference between Monolithic and Microservice 6. Features of Java 8 7. Progr...
read moreInterview questions for Software Engineer position
Describe recent project and technologies used
Explain dependency injection and differences between Rest and Soap
Differentiate Monolithic and Microservice architecture
List features of Java 8 and write programs using Java 8
Provide pseudo code for sorting a list of integers without using Java 8 sort method
Define functional interface and its annotation
Q4. Write a query to find the employee name who earns maximum salary
The query finds the employee name who earns the maximum salary.
Use the SELECT statement to retrieve the employee name and salary from the database table.
Use the ORDER BY clause to sort the results in descending order based on salary.
Use the LIMIT clause to limit the result to only one row.
Return the employee name from the query result.
Q5. What is the Default Methods and why it is required?
Default Methods are methods in interfaces with implementation, introduced in Java 8.
Introduced in Java 8 to provide backward compatibility for interfaces
Allows adding new methods to interfaces without breaking existing implementations
Default methods can be overridden in implementing classes
Example: default void display() { System.out.println("Default method"); }
Q6. 3. Write a program to sort a list in Ascending Order.
Program to sort a list in ascending order
Use a sorting algorithm like bubble sort, insertion sort, or selection sort
Compare adjacent elements and swap if necessary
Repeat until the list is sorted
Q7. TC questions: Types of datatypes? Predefined functions? Difference between list and tree? Who is more preferred? Difference between class and object? Difference between inheritance and polymorphism? Aptitude qu...
read moreInterview questions for Software Engineer position
Datatypes: int, float, string, boolean, etc.
Predefined functions: print(), len(), range(), etc.
List is linear while tree is hierarchical. Trees are preferred for faster search and insertion.
Class is a blueprint while object is an instance of a class.
Inheritance is a way to create a new class from an existing class while polymorphism is the ability of an object to take on many forms.
Aptitude question on time may involve calcula...read more
Q8. What is inheritance. Types of inheritance with examples. Polymorphism
Inheritance is a concept in object-oriented programming where a class inherits properties and methods from another class.
Inheritance allows code reuse and promotes code organization.
There are different types of inheritance: single, multiple, multilevel, and hierarchical.
Single inheritance is when a class inherits from only one parent class.
Multiple inheritance is when a class inherits from multiple parent classes.
Multilevel inheritance is when a class inherits from a parent c...read more
Q9. what are different phases of waterfall model?
Waterfall model has five phases: requirements, design, implementation, testing, and maintenance.
Requirements phase: gathering and documenting requirements
Design phase: creating a detailed design based on requirements
Implementation phase: coding and integrating components
Testing phase: verifying that the system meets requirements
Maintenance phase: making changes and updates to the system
Example: building a website using waterfall model
Example: developing a software application...read more
Q10. Explain IOC and dependency injection ?what is @Autowired
IOC is a design pattern where objects define their dependencies. Dependency Injection is a way to implement IOC. @Autowired is a DI annotation in Spring.
IOC - Inversion of Control is a design pattern where objects define their dependencies instead of creating them.
Dependency Injection is a way to implement IOC where dependencies are injected into an object at runtime.
Spring Framework provides @Autowired annotation for DI. It injects the dependency automatically.
Constructor In...read more
Q11. Describe the newly added features in Java 8?
Java 8 introduced features like lambda expressions, functional interfaces, streams, and default methods.
Lambda expressions allow you to write code in a more concise way.
Functional interfaces can have only one abstract method and are used with lambda expressions.
Streams provide a way to work with sequences of elements.
Default methods allow interfaces to have method implementations.
Example: Lambda expression - (int a, int b) -> a + b
Example: Functional interface - Consumer
Examp...read more
Q12. What is Multithreading?
Multithreading is the ability of a CPU to execute multiple threads concurrently, allowing for better performance and responsiveness in software applications.
Multithreading allows multiple threads to run concurrently within the same process.
Each thread has its own stack and program counter, but shares the same memory space.
Multithreading can improve performance by utilizing multiple CPU cores efficiently.
Examples of multithreading include web servers handling multiple requests...read more
Q13. What is the difference between a list and a tuple in Python?
List is mutable and can be modified, while tuple is immutable and cannot be changed.
Lists are defined using square brackets [], while tuples are defined using parentheses ().
Elements in a list can be changed, added, or removed, while elements in a tuple cannot be modified once it is created.
Lists are typically used for collections of similar items that may need to be modified, while tuples are used for fixed collections of items that should not change.
Example: list_example = ...read more
Q14. How does virtual dom update the actual dom?
Virtual DOM updates the actual DOM by comparing the virtual DOM with the actual DOM and only updating the necessary changes.
Virtual DOM is a lightweight copy of the actual DOM.
When changes are made, the virtual DOM is updated instead of the actual DOM.
The virtual DOM is then compared with the actual DOM to identify the differences.
Only the necessary changes are then applied to the actual DOM, minimizing re-renders and improving performance.
Q15. OOPS concepts with real time examples
OOPS concepts are fundamental to software engineering, with examples like inheritance, encapsulation, and polymorphism.
Inheritance: A child class inherits properties and behaviors from a parent class. For example, a Car class can inherit from a Vehicle class.
Encapsulation: Bundling data and methods that operate on the data into a single unit. For example, a BankAccount class with private variables and public methods.
Polymorphism: Objects can take on multiple forms. For exampl...read more
Q16. difference between 8085 and 8086 microprocessor
8086 is an advanced version of 8085 with more features and capabilities.
8086 has a 16-bit data bus while 8085 has an 8-bit data bus.
8086 has more registers than 8085.
8086 has a higher clock speed than 8085.
8086 supports virtual memory while 8085 does not.
8086 has a more advanced instruction set than 8085.
Example: 8086 can perform multiplication and division operations while 8085 cannot.
Q17. Write a SQL queries to get second most salary from Employee table
SQL query to get second highest salary from Employee table
Use ORDER BY and LIMIT to get the second highest salary
Use subquery to exclude the highest salary and get the second highest salary
Q18. Iteration over hashmap. Concurrent modification exception
How to avoid concurrent modification exception while iterating over a hashmap?
Use Iterator instead of foreach loop
Use ConcurrentHashMap instead of HashMap
Synchronize the hashmap while iterating
Use CopyOnWriteArrayList instead of ArrayList for values
Avoid modifying the hashmap while iterating
Q19. what is autowired annotation?
Autowired annotation is used in Spring framework to automatically inject dependencies into a bean.
Autowired annotation is used to automatically wire up dependencies in Spring framework.
It eliminates the need for manual wiring of dependencies in the code.
Autowired annotation can be used on fields, constructors, or methods.
Example: @Autowired private UserService userService;
Q20. Explain the react hooks that you have used until now.
I have used useState, useEffect, useContext, useReducer, and useRef hooks in React.
useState: Used for managing state in functional components.
useEffect: Used for side effects in functional components.
useContext: Used for accessing context in functional components.
useReducer: Used for managing complex state logic.
useRef: Used for accessing DOM elements or storing mutable values.
Q21. What are the life cycle methods?
Life cycle methods are methods that are called automatically by the framework at specific points in the component's life cycle.
Life cycle methods are used in frameworks like React and Angular to manage the state of components.
Examples of life cycle methods in React include componentDidMount, componentDidUpdate, and componentWillUnmount.
These methods allow developers to perform actions like fetching data, updating the UI, and cleaning up resources at specific points in the com...read more
Q22. Tell me about the new features introduced in es6?
ES6 introduced several new features including arrow functions, template literals, and let/const declarations.
Arrow functions provide a more concise syntax for writing functions.
Template literals allow for easier string interpolation and multiline strings.
Let/const declarations provide block scoping for variables.
Other features include classes, default function parameters, and the spread operator.
Example: const myFunction = (param1, param2) => { return param1 + param2 };
Exampl...read more
Q23. What are the functions using in software?
Functions are blocks of code that perform specific tasks in software.
Functions can be used to perform calculations, manipulate data, and control program flow.
Examples of functions include print(), sort(), and strlen().
Functions can be built-in to programming languages or created by the programmer.
Functions can also be organized into libraries or modules for reuse in multiple programs.
Q24. Oops Concept eg. What is Abstraction?
Abstraction is the process of hiding complex implementation details and showing only the necessary information to the user.
Abstraction is a fundamental concept in object-oriented programming.
It allows us to create abstract classes and interfaces that define the necessary functionality without specifying the implementation details.
Abstraction helps to reduce complexity and improve maintainability of code.
For example, a car dashboard is an abstraction of the car's internal work...read more
Q25. Framework on which you have experience
I have experience working with the Angular framework.
Developed web applications using Angular framework
Implemented features like data binding, routing, and services
Worked with Angular CLI for project setup and management
Q26. How do you create applications in software?
Applications are created by designing, coding, testing, and deploying software using programming languages and development tools.
Design the application by identifying user requirements and creating a plan
Write code using programming languages such as Java, Python, or C++
Test the application to ensure it functions correctly and meets user requirements
Deploy the application to a server or cloud platform for users to access
Continuously maintain and update the application to fix ...read more
Q27. What is difference between final finally and finalize
final is a keyword used to declare constants, finally is a block of code that always executes, and finalize is a method used for cleanup operations.
final is used to declare constants in Java
finally is a block of code that is always executed, typically used for cleanup operations or releasing resources
finalize is a method in Java used for cleanup operations before an object is garbage collected
Q28. Annotations used in spring ? explain spring MVC?
Annotations used in Spring and explanation of Spring MVC.
Annotations used in Spring: @Autowired, @Component, @Controller, @Service, @Repository, @RequestMapping, @PathVariable, @RequestParam, @ResponseBody, @ExceptionHandler
Spring MVC is a framework for building web applications using the Model-View-Controller architecture.
It provides components like DispatcherServlet, HandlerMapping, ViewResolver, and others to handle requests and responses.
Spring MVC also supports RESTful w...read more
Q29. Sort the array and write a code for searching array element
Sort and search an array in software engineering interview
Use built-in sorting functions or implement your own sorting algorithm
For searching, use linear search or binary search depending on the size of the array
Consider the time complexity of the sorting and searching algorithms
Ensure the code is efficient and handles edge cases properly
Q30. What are Aggregate Functions in sql
Aggregate functions perform calculations on a set of values and return a single value.
Examples include SUM, AVG, COUNT, MAX, and MIN.
They are used with the SELECT statement to summarize data.
Aggregate functions can be used with GROUP BY clause to group data by one or more columns.
They can also be used with HAVING clause to filter groups based on a condition.
Q31. 4. Write a program to Reverse a String
Program to reverse a string
Create an empty string to store the reversed string
Loop through the original string from the end to the beginning
Append each character to the empty string
Return the reversed string
Q32. What is difference procedure and functions.
Procedures do not return values while functions return values.
Procedures are a set of instructions that perform a specific task without returning a value.
Functions are a set of instructions that perform a specific task and return a value.
Procedures are called using the CALL statement in SQL.
Functions are called by using their name followed by parentheses containing any arguments.
Q33. Would you be flexible to learn Java if you are already having 3year experience in .NET
Yes, I am open to learning Java despite having experience in .NET.
Learning Java will broaden my skill set and make me more versatile as a software engineer.
Many concepts in .NET are transferable to Java, making the learning curve less steep.
Being proficient in multiple languages can open up more job opportunities in the future.
Q34. What is interface ?
An interface is a contract that specifies the methods and properties that a class must implement.
An interface defines a set of methods and properties that a class must implement
It provides a way to achieve abstraction and polymorphism in object-oriented programming
Interfaces are declared using the interface keyword in languages like Java and C#
Classes can implement multiple interfaces
Example: The Comparable interface in Java defines a compareTo() method that must be implement...read more
Q35. What is prop drilling in react?
Prop drilling is the process of passing props from a parent component to a deeply nested child component through intermediate components.
It can lead to complex and hard-to-maintain code.
Context API and Redux can be used to avoid prop drilling.
Example: passing a prop from App component to a deeply nested child component through multiple intermediate components.
Q36. How do you make your application secure?
Secure applications by implementing authentication, authorization, encryption, and regular updates.
Implement strong authentication mechanisms such as multi-factor authentication
Use authorization to control access to sensitive data and functionality
Encrypt sensitive data both in transit and at rest
Regularly update software and apply security patches
Perform regular security audits and penetration testing
Q37. Difference between sorted procedure vs function ?
Sorted procedure sorts data in place while sorted function returns a new sorted list.
Sorted procedure modifies the original list while sorted function returns a new sorted list.
Sorted procedure is faster for large lists as it doesn't create a new list.
Sorted function is useful when original list needs to be preserved.
Example of sorted procedure: list.sort()
Example of sorted function: sorted(list)
Q38. what is pump what is C lang. what do you mean by object oriented.
Answering questions related to pump, C lang, and object-oriented programming.
A pump is a device used to move fluids or gases from one place to another.
C lang is a programming language used for system programming and embedded systems.
Object-oriented programming is a programming paradigm that uses objects to represent data and methods to manipulate that data.
Examples of object-oriented programming languages include Java, C++, and Python.
Q39. What do you know about cloud computing
Cloud computing is the delivery of computing services over the internet.
Cloud computing allows users to access data and applications from anywhere with an internet connection
It offers scalability, flexibility, and cost-effectiveness
Examples include Amazon Web Services, Microsoft Azure, and Google Cloud Platform
Q40. Difference between interface and abstract
Interface defines only method signatures while abstract class can have both method signatures and implementations.
An interface can be implemented by multiple classes while an abstract class can only be extended by one class.
An abstract class can have constructors while an interface cannot.
An abstract class can have instance variables while an interface cannot.
An abstract class can have non-abstract methods while an interface can only have abstract methods.
An abstract class ca...read more
Q41. What is stored procedure ?
A stored procedure is a set of precompiled SQL statements that are stored in a database and can be executed later.
Stored procedures are used to encapsulate and execute frequently used SQL statements.
They improve performance by reducing network traffic and optimizing query execution.
Stored procedures can accept input parameters and return output parameters or result sets.
They can be used for complex data manipulation, transaction management, and security enforcement.
Examples i...read more
Q42. Difference Between Primary key and Unique key
Primary key uniquely identifies a record in a table, while Unique key ensures that all values in a column are distinct.
Primary key can't have null values, while Unique key can have one null value.
A table can have only one Primary key, but multiple Unique keys.
Primary key is used as a foreign key in other tables, while Unique key is not necessarily used as a foreign key.
Q43. why we need interface in java?
Interfaces provide a way to achieve abstraction and loose coupling in Java.
Interfaces allow for multiple inheritance of type in Java.
Interfaces provide a way to achieve abstraction and loose coupling in Java.
Interfaces are used to define a contract for classes that implement them.
Interfaces can be used to achieve polymorphism in Java.
Interfaces are commonly used in Java frameworks and APIs.
Example: Comparable interface in Java allows objects to be compared and sorted.
Example:...read more
Q44. What is the difference between JPA and Hibernate
JPA is a specification for Java persistence API, while Hibernate is an implementation of JPA.
JPA is a specification for Java persistence API, while Hibernate is a popular ORM framework that implements JPA.
Hibernate provides additional features beyond JPA specification, such as caching and query optimization.
JPA is a set of interfaces and annotations, while Hibernate provides the actual implementation of these interfaces.
Q45. what is the difference between java 7 and java 8
Java 8 introduced new features like lambda expressions, streams, and default methods compared to Java 7.
Java 8 introduced lambda expressions for functional programming.
Java 8 added streams API for processing collections in a functional style.
Java 8 introduced default methods in interfaces to allow adding new methods to interfaces without breaking existing implementations.
Java 8 included the new Date and Time API (java.time) to address the shortcomings of the old java.util.Dat...read more
Q46. What agile process do you follow?
I follow the Scrum agile process.
I work in sprints of 2-4 weeks.
I hold daily stand-up meetings to discuss progress and blockers.
I prioritize tasks using a product backlog.
I conduct sprint retrospectives to continuously improve the process.
I collaborate closely with the product owner and stakeholders.
Example: I used Scrum to develop a mobile app for a client, delivering features in sprints and receiving feedback regularly.
Q47. skeleton of html , what is variables?
HTML skeleton and variables
HTML skeleton includes basic structure of a webpage
Variables are used to store and manipulate data in programming
In HTML, variables can be used with JavaScript or server-side languages
Example:
Page Title Hello, {{name}}!
Q48. Write a program to print Pascal triangle
Program to print Pascal triangle
Use nested loops to generate the triangle
Each row has one more element than the previous row
The first and last element of each row is always 1
The middle elements can be calculated using the formula: C(n, k) = C(n-1, k-1) + C(n-1, k)
Q49. What is views and materialized views
Views and materialized views are database objects that store queries and results for easy access and improved performance.
Views are virtual tables created by a query, allowing users to access specific data without storing it physically.
Materialized views are physical copies of query results that are stored on disk, improving performance by reducing the need to re-run the query.
Materialized views need to be refreshed periodically to ensure they reflect the most current data.
Vi...read more
Q50. difference between monolithic architecture and Microservices
Monolithic architecture is a single-tiered software application where all components are interconnected and interdependent, while Microservices is a distributed architecture where the application is broken down into smaller, independent services.
Monolithic architecture is a single, indivisible unit, making it difficult to scale and update without affecting the entire system.
Microservices architecture breaks down the application into smaller, independent services that communic...read more
Q51. What is design patterns in java
Design patterns are reusable solutions to common software problems in Java.
Design patterns provide a standard way to solve common problems in software development.
They help in creating flexible, reusable, and maintainable code.
Examples of design patterns include Singleton, Factory, Observer, and Decorator.
Design patterns can be categorized into three types: creational, structural, and behavioral.
Q52. Explain microservice components
Microservice components are small, independent services that work together to form a larger application.
Each microservice has its own unique function and can be developed and deployed independently
They communicate with each other through APIs or messaging systems
They are often containerized for easy deployment and scaling
Examples include user authentication, payment processing, and inventory management
Q53. draw pin diagram of 8085 microprocessor
Pin diagram of 8085 microprocessor
8085 has 40 pins in total
Pins are grouped into 5 categories: power supply, address bus, data bus, control and status signals
Pin 1 is the reset pin, Pin 40 is the Vcc pin
Examples of control signals: RD, WR, ALE, INT, HOLD
Examples of status signals: S0, S1, IO/M, HLDA
Q54. what is opamp?
Opamp stands for operational amplifier. It is an electronic device used to amplify and process signals.
Opamps have high gain and can amplify signals to a very high degree.
They are commonly used in audio amplifiers, filters, and signal processing circuits.
Opamps have two input terminals and one output terminal.
They can be configured in different ways to perform various functions such as amplification, filtering, and oscillation.
Examples of opamps include LM741, LM358, and TL08...read more
Q55. What is transient keyword in java
The transient keyword in Java is used to indicate that a variable should not be serialized.
Variables marked as transient will not be included in the serialization process
Transient variables are not saved to the file system when an object is serialized
Use transient keyword to prevent sensitive data from being serialized
Q56. What is entity framework ?
Entity Framework is an ORM framework for .NET applications.
It allows developers to work with databases using .NET objects.
It supports various database providers such as SQL Server, MySQL, Oracle, etc.
It provides features like LINQ to Entities, automatic change tracking, and database migrations.
It reduces the amount of boilerplate code needed for database operations.
Example: DbContext class is used to interact with the database in Entity Framework.
Q57. What is Lemba expression ?
Lemba expression is a programming language used for scientific computing and data analysis.
Lemba is designed to be simple and easy to learn.
It supports matrix operations and has built-in functions for statistical analysis.
Lemba can be used for machine learning and data visualization.
Example: sum([1, 2, 3]) returns 6.
Q58. Difference Between method over loading and overriding
Method overloading is having multiple methods in the same class with the same name but different parameters. Method overriding is having a method in a subclass with the same name and parameters as a method in the superclass.
Method overloading is resolved at compile time based on the method signature and parameters.
Method overriding is resolved at runtime based on the actual object type.
Method overloading is used to provide different implementations of the same method for diff...read more
Q59. What is local storage vs session storage
Local storage and session storage are two types of web storage used to store data on the client-side.
Local storage stores data with no expiration date, while session storage stores data for a single session.
Local storage has a larger storage capacity than session storage.
Data stored in local storage is available even after the browser is closed and reopened, while data stored in session storage is lost when the browser is closed.
Both local storage and session storage can only...read more
Q60. What is stack?
A stack is a data structure that follows the Last In First Out (LIFO) principle.
Elements are added to the top of the stack and removed from the top.
Common operations include push (add element) and pop (remove element).
Stacks are used in programming for function calls, expression evaluation, and memory management.
Q61. types of joins in sql
Types of joins in SQL
Inner join: returns only the matching rows from both tables
Left join: returns all rows from the left table and matching rows from the right table
Right join: returns all rows from the right table and matching rows from the left table
Full outer join: returns all rows from both tables
Cross join: returns the Cartesian product of both tables
Q62. What are closures?
Closures are functions that have access to variables from their containing scope even after the parent function has finished executing.
Closures allow functions to 'remember' the environment in which they were created
They can access variables from their outer scope even after the outer function has finished executing
Closures are commonly used in event handlers and callbacks
Q63. What is hoisting?
Hoisting is a JavaScript mechanism where variable and function declarations are moved to the top of their containing scope during compilation.
Variable and function declarations are hoisted to the top of their scope.
Only declarations are hoisted, not initializations.
Function declarations take precedence over variable declarations.
Q64. What are basics languages in c++,
Basics languages in C++ include C, Java, Python, and Ruby.
C is the foundation of C++ and provides low-level memory manipulation.
Java is an object-oriented language that runs on a virtual machine.
Python is a high-level language with a focus on readability and simplicity.
Ruby is a dynamic, reflective, object-oriented, general-purpose language.
Q65. What are the lifecycle hooks in Angular
Lifecycle hooks in Angular are methods that allow you to tap into the lifecycle of a component or directive.
Lifecycle hooks include ngOnInit, ngOnChanges, ngDoCheck, ngOnDestroy, etc.
ngOnInit is used for initialization logic, ngOnChanges is used for reacting to changes in input properties, ngOnDestroy is used for cleanup tasks, etc.
Q66. Explain the term inheritance?
Inheritance is a mechanism in object-oriented programming where a new class is created by inheriting properties of an existing class.
Inheritance allows code reusability and saves time and effort in writing new code.
The existing class is called the parent or base class, and the new class is called the child or derived class.
The child class inherits all the properties and methods of the parent class and can also add its own unique properties and methods.
For example, a class 'An...read more
Q67. what is overloading in java
Overloading in Java is the ability to have multiple methods with the same name but different parameters.
Overloading allows for more flexibility in method naming and improves code readability.
The methods must have different parameter types or number of parameters.
Example: void print(int num) and void print(String str) are overloaded methods.
Overloading is determined at compile-time based on the method signature.
Q68. What is an array?
An array is a collection of elements of the same data type, stored in contiguous memory locations.
Arrays can be one-dimensional or multi-dimensional
Elements in an array can be accessed using their index
Arrays can be initialized with values at declaration
Examples: int[] numbers = {1, 2, 3}; char[] letters = {'a', 'b', 'c'};
Arrays have a fixed size once declared
Q69. Explain data type in c?
Data type in C refers to the type of data that a variable can hold.
C has basic data types like int, float, char, double, etc.
Derived data types like arrays, pointers, structures, and unions can also be created.
Each data type has a specific range of values that it can hold.
Data types can be modified using type qualifiers like const, volatile, etc.
Q70. Whar is abstract class?
An abstract class is a class that cannot be instantiated and is used as a base class for other classes.
An abstract class can have abstract and non-abstract methods.
Abstract methods have no implementation and must be implemented by the derived classes.
An abstract class can have constructors and fields.
An abstract class can be used to define a common interface for a group of related classes.
Example: Animal is an abstract class and Dog, Cat, and Bird are derived classes that inh...read more
Q71. Difference between Physical file and logical file
Physical file stores data on disk, while logical file is a view of data from physical files.
Physical file contains actual data on disk
Logical file is a view of data from one or more physical files
Physical file is used for storage and retrieval of data
Logical file simplifies data access by providing a single view of related data
Changes to physical file structure affect all logical files based on it
Q72. Write code to reverse string in Python?
Code to reverse a string in Python using slicing.
Use string slicing with a step of -1 to reverse the string.
Example: 'hello'[::-1] will return 'olleh'.
Q73. code to remove duplicate entries in a string
Code to remove duplicate entries in a string
Create an empty array to store unique strings
Iterate through each string in the input array
Check if the string is already in the unique array, if not add it
Q74. What is life cycle of thread
Thread life cycle includes new, runnable, running, blocked, and terminated states.
Thread is created in new state
It becomes runnable when start() method is called
Thread enters running state when CPU starts executing its run() method
Thread can be blocked when waiting for a resource or I/O operation
Thread enters terminated state when run() method completes or stop() method is called
Q75. What is synchronisation in java.
Synchronization in Java is the process of controlling access to shared resources by multiple threads.
Synchronization is achieved using the synchronized keyword in Java.
It ensures that only one thread can access the shared resource at a time.
Synchronization can be applied to methods or blocks of code.
It is used to prevent race conditions and ensure thread safety.
Example: synchronized void myMethod() { //code }
Example: synchronized(this) { //code }
Q76. What is a directive in Angular
Directives in Angular are markers on DOM elements that tell Angular's HTML compiler to attach a specified behavior to that DOM element or even transform the DOM element and its children.
Directives are used to create reusable components or add behavior to existing elements.
There are three types of directives in Angular: Component, Structural, and Attribute directives.
Example: ngIf is a structural directive that conditionally adds or removes elements from the DOM.
Q77. types of testing
Types of testing include unit, integration, system, acceptance, regression, performance, and security testing.
Unit testing: testing individual units or components of the software
Integration testing: testing how different units or components work together
System testing: testing the entire system as a whole
Acceptance testing: testing to ensure the software meets the requirements and is ready for release
Regression testing: testing to ensure changes or updates to the software do ...read more
Q78. Writing length of string without length method
Use a loop to iterate through each character in the string and count the characters until reaching the end.
Iterate through each character in the string using a loop
Increment a counter for each character encountered
Stop when reaching the end of the string
Q79. Write string reverse program
Program to reverse a given string.
Iterate through the string from end to start and append each character to a new string.
Use built-in functions like reverse() or slice() in some programming languages.
Convert the string to an array, reverse the array, and then join the array back into a string.
Q80. What is the differences joins.
Joins are used in databases to combine rows from two or more tables based on a related column between them.
Inner Join: Returns rows when there is at least one match in both tables.
Left Join (or Left Outer Join): Returns all rows from the left table and the matched rows from the right table.
Right Join (or Right Outer Join): Returns all rows from the right table and the matched rows from the left table.
Full Join (or Full Outer Join): Returns rows when there is a match in one of...read more
Q81. Combination using stream api in Java8
Combination using stream api in Java8
Use Stream.flatMap() to create all possible combinations
Use Stream.reduce() to combine the combinations
Use Stream.collect() to collect the combinations into a list or set
Q82. What is gibs free energy?
Gibbs free energy is a thermodynamic potential that measures the maximum amount of work that can be obtained from a system.
It is denoted by the symbol G.
It takes into account both the enthalpy and entropy of a system.
A negative value of G indicates that a reaction is spontaneous.
It is used to predict the feasibility of a chemical reaction.
It is also used in the study of phase transitions and the stability of materials.
Q83. Difference between C++ and Python?
C++ is a statically typed language with high performance, while Python is dynamically typed with simpler syntax.
C++ is statically typed, while Python is dynamically typed
C++ is compiled, while Python is interpreted
C++ is faster in terms of performance, while Python is easier to read and write
C++ is commonly used for system programming and game development, while Python is popular for web development and data analysis
Q84. Difference between List and Tuples?
Lists are mutable while tuples are immutable in Python.
Lists are enclosed in square brackets [], while tuples are enclosed in parentheses ().
Lists can be modified after creation, while tuples cannot be modified (immutable).
Lists are typically used for collections of similar items, while tuples are used for fixed collections of items.
Example: list_example = [1, 2, 3], tuple_example = (4, 5, 6)
Q85. Client side vs server side scripting
Client side scripting runs on the user's browser, while server side scripting runs on the server.
Client side scripting is executed on the user's browser, allowing for dynamic interactions without reloading the page (e.g. JavaScript).
Server side scripting is executed on the server, generating dynamic content before sending it to the user's browser (e.g. PHP, Python).
Q86. What are the types of subfile
Types of subfiles include single page subfile, multiple page subfile, and continuous subfile.
Single page subfile displays a single page of data at a time.
Multiple page subfile allows for paging through multiple pages of data.
Continuous subfile displays all records at once with no paging.
Q87. Define oops and all of its principles
OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects.
OOPs principles include Inheritance, Encapsulation, Polymorphism, and Abstraction.
Inheritance allows a class to inherit properties and behavior from another class.
Encapsulation refers to the bundling of data with the methods that operate on that data.
Polymorphism allows objects to be treated as instances of their parent class.
Abstraction hides the complex implementation d...read more
Q88. Find if a string is pallindrome or not
Check if a string is a palindrome by comparing it to its reverse.
Create a function that takes a string as input.
Reverse the string and compare it to the original string.
If they are the same, the string is a palindrome.
Example: 'racecar' is a palindrome.
Q89. Write a program using recursion
A program using recursion
Recursion is a technique where a function calls itself to solve a problem
It involves a base case and a recursive case
Examples include factorial, Fibonacci sequence, and binary search
Q90. Difference between++I and I++
++I is a pre-increment operator that increments the value of I before using it, while I++ is a post-increment operator that increments the value of I after using it.
++I increments the value of I and then uses the updated value in the expression.
I++ uses the current value of I in the expression and then increments it.
Both operators can be used with variables, arrays, or pointers.
Q91. String vs string buffer
String is immutable while StringBuffer is mutable in Java.
StringBuffer is more efficient when performing a lot of string manipulations
StringBuffer has methods to append, insert, and delete characters
String is better for small string operations and is thread-safe
StringBuffer is not thread-safe but can be made thread-safe with synchronization
Example: String str = "hello"; StringBuffer sb = new StringBuffer(str);
Example: sb.append(" world"); System.out.println(sb.toString()); //...read more
Q92. What is BR in ServiceNow
BR in ServiceNow stands for Business Rule.
BR is a type of automation that executes when a record is inserted, updated, deleted, displayed, or queried.
BRs are used to enforce business logic, data integrity, and automate processes.
Examples of BRs include sending email notifications when a record is updated, enforcing data validation rules, and triggering workflows.
Q93. What is css box model
CSS box model is a design concept that describes how elements are displayed on a webpage.
It consists of content, padding, border, and margin.
Content is the actual element content, padding is the space between the content and the border, border is the element's border, and margin is the space between the border and other elements.
The box model can be adjusted using CSS properties such as padding, border, and margin.
Understanding the box model is important for designing respons...read more
Q94. What is data structures
Data structures are ways of organizing and storing data in a computer so that it can be accessed and used efficiently.
Data structures are used to manage and manipulate data in computer programs.
They can be implemented using arrays, linked lists, trees, graphs, and other techniques.
Examples include stacks, queues, hash tables, and binary search trees.
Choosing the right data structure can have a big impact on the performance of a program.
Q95. Various types of modules and sections
Modules and sections are components of software that serve specific functions.
Modules are self-contained units of code that can be reused in different parts of the software.
Sections are parts of the software that perform specific tasks or functions.
Examples of modules include libraries, plugins, and frameworks.
Examples of sections include login pages, search bars, and shopping carts.
Q96. What is java 8 features
Java 8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods.
Lambda expressions allow you to write code in a more concise and readable way.
Functional interfaces are interfaces with a single abstract method, which can be implemented using lambda expressions.
Streams provide a way to work with sequences of elements and perform operations like filter, map, and reduce.
Default methods allow interfaces to have method implem...read more
Q97. wht is the use of enum?
Enums are used to define a set of named constants, making code more readable and maintainable.
Enums help in improving code readability by giving meaningful names to constants
They provide type safety by restricting variables to only hold values from the defined set
Enums can be used in switch statements to handle different cases easily
Q98. What is sequence
A sequence is a ordered list of elements or events following a specific pattern or order.
A sequence can be in ascending or descending order.
Examples include Fibonacci sequence, arithmetic progression, and DNA sequence.
Sequences can be finite or infinite.
Q99. What is the class?
A class is a blueprint for creating objects that have similar attributes and methods.
A class is a user-defined data type that encapsulates data and functions.
It is a template for creating objects.
It provides a way to organize and structure code.
Objects are instances of a class.
Classes can inherit properties and methods from other classes.
Examples include String, Integer, and List in Java.
Q100. why we use mvc ?
MVC is used to separate concerns in software development, making code more organized and maintainable.
Separates concerns of data, presentation, and logic
Improves code reusability and maintainability
Enhances testability of the application
Promotes scalability and flexibility
Examples: ASP.NET MVC, Ruby on Rails, Spring MVC
More about working at Cognizant
Top HR Questions asked in V2soft
Interview Process at V2soft
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month