NCR Voyix
10+ Johnson Controls Interview Questions and Answers
Q1. What are interfaces and what is difference between an interface and abstract class
Interfaces define a contract for behavior, while abstract classes provide partial implementation.
Interfaces only define method signatures, while abstract classes can have both abstract and concrete methods.
A class can implement multiple interfaces, but can only inherit from one abstract class.
Interfaces are used for loose coupling and flexibility in design.
Abstract classes are used for code reuse and to enforce a common implementation among subclasses.
Q2. what is difference between stored procedure and function
Stored procedures are used to perform a set of actions, while functions return a single value.
Stored procedures are precompiled and stored in the database, while functions are compiled at runtime.
Functions can be used in SQL statements, while stored procedures cannot be used in SQL statements.
Functions can be called from within stored procedures, but stored procedures cannot be called from within functions.
Q3. what is difference between virtual and override keywords
Virtual keyword is used to declare a method in a base class that can be overridden in a derived class. Override keyword is used in the derived class to override the implementation of the virtual method.
Virtual keyword is used in the base class to declare a method that can be overridden in the derived class
Override keyword is used in the derived class to override the implementation of the virtual method
Virtual methods provide a way for a base class to define a default implemen...read more
Q4. what are solid principles and explain them
SOLID principles are a set of five design principles for writing maintainable and scalable code.
Single Responsibility Principle (SRP) - a class should have only one reason to change
Open-Closed Principle (OCP) - a class should be open for extension but closed for modification
Liskov Substitution Principle (LSP) - subtypes should be substitutable for their base types
Interface Segregation Principle (ISP) - clients should not be forced to depend on interfaces they do not use
Depend...read more
Q5. Program to find the second largest element from a 4-digit number, ex: input 1245 return 4
Program to find the second largest element from a 4-digit number
Convert the number to a string and split it into an array of characters
Sort the array in descending order
Return the second element of the array
Q6. what is a singleton design pattern
Singleton design pattern restricts the instantiation of a class to a single instance and provides a global point of access to it.
Used when only one instance of a class is required throughout the system
Provides a global point of access to the instance
Implemented using a private constructor, static method, and static variable
Example: Logger class, Database connection class
Q7. does c# support multiple inheritence
No, C# does not support multiple inheritance.
C# only supports single inheritance, where a class can inherit from only one base class.
However, C# does support multiple interface inheritance, where a class can implement multiple interfaces.
This is achieved using the 'interface' keyword instead of 'class'.
Q8. how routing is done in mvc
Routing in MVC is done through the use of routes, which map URLs to controller actions.
Routes are defined in the RouteConfig.cs file in the App_Start folder
Routes consist of a URL pattern and a corresponding controller action
Routes can also include optional parameters and constraints
Routing is done through the use of the ASP.NET routing engine
Routing can be customized by creating custom route handlers
Q9. what is singleton design pattern
Singleton design pattern restricts the instantiation of a class to a single instance and provides a global point of access to it.
Used when only one instance of a class is required throughout the system
Provides a global point of access to the instance
Implemented using a private constructor, static method, and static variable
Example: Logger class in Java
Q10. what are extension methods
Extension methods are static methods that allow adding new functionality to existing types without modifying the original type.
Extension methods are defined in a static class.
They must be declared with the 'this' keyword before the first parameter.
They can be called as if they were instance methods of the extended type.
Extension methods can be used to add functionality to built-in types or custom types.
Example: adding a method to the string type to convert a string to title c...read more
Q11. what are filters in mvc
Filters in MVC are used to intercept and modify HTTP requests and responses.
Filters can be used to implement authentication and authorization.
They can also be used for caching and logging.
Examples of filters include AuthorizationFilter, ActionFilter, and ExceptionFilter.
Q12. what are indexes in sql
Indexes in SQL are used to improve the performance of queries by allowing faster data retrieval.
Indexes are created on one or more columns of a table.
They work like a book index, allowing the database to quickly find the data.
Indexes can be clustered or non-clustered.
Clustered indexes determine the physical order of data in a table.
Non-clustered indexes create a separate structure to store the index data.
Indexes should be used carefully as they can slow down data modification...read more
Q13. what is dependency injection
Dependency injection is a design pattern used to remove hard-coded dependencies and make code more modular and testable.
Dependency injection involves injecting dependencies into a class rather than having the class create them itself.
This allows for easier testing and swapping out of dependencies.
There are three types of dependency injection: constructor injection, setter injection, and interface injection.
Examples of dependency injection frameworks include Spring and Guice.
Q14. explain about dependency injection
Dependency injection is a design pattern that allows objects to receive dependencies from external sources rather than creating them internally.
Dependency injection helps to decouple components and make them more reusable and testable.
There are three types of dependency injection: constructor injection, setter injection, and interface injection.
Example: Instead of creating a database connection object inside a class, we can inject it from outside.
Dependency injection framewor...read more
Top HR Questions asked in Johnson Controls
Reviews
Interviews
Salaries
Users/Month