Hot Topics
Zenser Solution
Technical Round
- Question 1
What is regression?
- Answer
Regression basically is a statistical method that helps us to understand relationship between two or more variables of interest. There are different kinds of regression such as linear regression, logistic regression, polynomial regression, etc.
- Question 2
Describe your project and your role on it.
- Answer
Tell about the project with which you worked and the role you fulfilled in that project.
- Question 3
String program to check and print repeated words.
- Answer
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
bool uniqueCharacters(char str[]);
int main() {
char str[] = "CodeWindow";
if (uniqueCharacters(str)) {
printf("String has no duplicate characters");
}
else {
printf("String has duplicate characters");
}
return 0;
}
bool uniqueCharacters(char str[])
{
for(int i=0;i<strlen(str);i++){
for (int j = i + 1; j < strlen(str); j++) {
if (str[i] == str[j]) {
return false;
}
}
}
return true;
}
/*
output:
String has duplicate characters
*/
- Question 4
Difference between C & C++.
- Answer
C | C++ |
1. C was developed by Dennis Ritchie in 1972. | C++ was developed by Bjame Stroustrup in 1979. |
2. C is a Procedural Programming language. | C++ is an Object Oriented programming language. |
3. C is a subset of C++. | C++ is a superset of C. |
4. C contains 32 keywords. | C++ contains 52 keywords. |
5. C does not support inheritance, polymorphism, encapsulation and abstraction. | C++ supports inheritance, polymorphism, encapsulation and abstraction. |
6. Function and operator overloading is not supported in C. | Function and operator overloading is supported in C++. |
- Question 5
What is DBMS, queries like update, delete, join, alter?
- Answer
DBMS is a collection of programs that enables users to create and maintain a database. In other words, it is general purpose software that provides the user with the processes of defining, constructing and manipulating the database for various applications.
- Question 6
How would you rate yourself in Java?
- Answer
Rate yourself out of 5 and keep in mind don’t rate too high or too low. You can rate yourself 3.5 out of 5.
- Question 7
What is CSS and is it case sensitive?
- Answer
CSS stands for Cascading Style Sheets which is a rule based language used over HTML to make the web page more appealing to users.
CSS is case insensitive.
- Question 8
Oops Asp.net MVC SQL Server
- Answer
ASP.NET MVC is a web application framework that uses the Model-View-Controller (MVC) architectural pattern for building scalable, maintainable, and testable web applications. It provides an ideal platform for building dynamic, data-driven, and interactive web applications using a pattern-based approach.
SQL Server is a popular and widely used relational database management system (RDBMS) developed by Microsoft. It is used to store, manage, and retrieve data from databases in an efficient and organized manner.
In an ASP.NET MVC application, you can use SQL Server as a back-end database to store and manage the application data. You can connect to the SQL Server database using ADO.NET or Entity Framework, both of which are available in ASP.NET MVC.
ADO.NET is a data access technology that provides a set of classes and APIs for accessing data from a database. Entity Framework is an Object-Relational Mapping (ORM) tool that allows you to work with data in a more object-oriented way.
Using SQL Server in an ASP.NET MVC application provides several benefits:
Scalability: SQL Server can handle large amounts of data and handle multiple concurrent users, making it suitable for large-scale web applications.
Security: SQL Server provides a robust set of security features that help to protect your data and prevent unauthorized access.
Performance: SQL Server provides fast data retrieval and data manipulation capabilities, making it ideal for high-performance web applications.
Integration: SQL Server integrates easily with other Microsoft technologies, such as ASP.NET and Visual Studio, making it easier to build web applications using familiar tools.
- Question 9
How to implement singleton class?
- Answer
A singleton class is a class that can only have one instance in a given application and provides a single point of access to that instance. In C++, you can implement a singleton class as follows:
Declare a private constructor: To ensure that only one instance of the class is created, the constructor should be declared private.
Declare a private static instance variable: This variable will store the single instance of the class.
Provide a public static method for accessing the instance: This method should return the single instance of the class, creating it if it does not already exist.
Here’s a sample implementation in C++:
class Singleton {
private:
static Singleton* instance;
Singleton() {}
public:
static Singleton* getInstance() {
if (instance == nullptr) {
instance = new Singleton();
}
return instance;
}
};
Singleton* Singleton::instance = nullptr;
- Question 10
Do you know Microservices?
- Answer
Yes, I am familiar with Microservices.
Microservices is an architectural style for building applications as a suite of independently deployable, small, and modular services. Each service runs in its own process and communicates with other services through well-defined APIs.
The main advantage of Microservices is that it allows for faster development and deployment of individual services, and makes it easier to scale and maintain the application as a whole. It also enables teams to work more independently and use different technologies for each service as needed.
Microservices architecture can be used to build complex and large-scale applications and can provide greater flexibility and resilience compared to a monolithic architecture. However, it also requires a more complex infrastructure and can lead to increased communication overhead between services.
- Question 11
Difference between String literal and new String
- Answer
In Java, there are two ways to create a string: as a string literal or as a new String object. The difference between the two is related to memory allocation and object creation.
A string literal is created by enclosing a sequence of characters in double quotes. For example:
String s = "Hello World";
In this case, the string literal “Hello World” is stored in a special area of the Java virtual machine called the string pool. When multiple string literals with the same value are created, the Java virtual machine reuses the same memory location for all of them. This helps to reduce memory usage and improve performance.
A new String object, on the other hand, is created using the new
keyword, followed by a call to the String
class constructor. For example:
String s = new String("Hello World");
In this case, a new object is created on the heap, and its value is set to “Hello World”. The reference to this object is stored in the s
variable. This method of creating a string is less efficient than using a string literal, as it involves allocating additional memory and creating a new object.
In general, it’s recommended to use string literals wherever possible, as they provide better performance and memory usage. The new
keyword should only be used when it’s necessary to create a new string object, such as when concatenating strings or creating a copy of an existing string.
- Question 12
Why is superclass called meta data?
- Answer
The term “meta data” is generally used to describe data that provides information about other data. In the context of programming, a superclass can be thought of as meta data for its subclasses, as it provides a blueprint or set of characteristics that the subclasses inherit and build upon. So, the superclass can be considered as a kind of meta data that defines the structure and behavior of its subclasses.
- Question 13
Write a c program to move the cursor to x,y coordinates in the console
- Answer
Here is an example of a C program to move the cursor to specific x, y coordinates in a console
#include <stdio.h>
#include <windows.h>
void gotoxy(int x, int y) {
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
int main() {
gotoxy(10, 10);
printf("Hello, World!");
return 0;
}
- Question 14
How do you optimise a SQL query?
- Answer
Indexing: Indexes can significantly speed up query performance by allowing the database to quickly locate the rows that match a query’s WHERE clause. Make sure to add indexes on columns that are frequently used in WHERE clauses, JOIN conditions, and GROUP BY statements.
Normalization: Normalizing your database tables can reduce the amount of redundant data, which can speed up queries and reduce the amount of disk space used by the database.
Use the appropriate data types: Choosing the correct data type for each column can reduce the amount of disk space used and improve query performance.
Simplify the query: Complex queries with multiple nested subqueries and UNIONs can slow down performance. Try to simplify the query by breaking it down into smaller, simpler queries that can be combined later.
Use appropriate join types: Different join types have different performance implications. For example, an inner join is faster than an outer join, while a left join is slower than a right join.
Avoid using functions in WHERE clauses: Functions in WHERE clauses can slow down query performance because they are executed for each row in the table. Instead, consider using the function in the SELECT clause and indexing the result.
Limit the number of rows returned: Queries that return large amounts of data can be slow. Use the
LIMIT
clause to limit the number of rows returned by a query.Use prepared statements: Prepared statements can be faster than dynamically generated SQL, because the database can reuse the query plan for multiple executions.
Use explain plan: Running an
EXPLAIN
statement before a query can give you information about the query’s execution plan, including which indexes are being used, and how many rows are being scanned. Use this information to optimize the query.
These are just a few of the many ways to optimize SQL queries. The specific optimizations you choose will depend on your particular requirements, the structure of your data, and the specifics of your database system.
- Question 15
What is doubly linked list?
- Answer
Doubly linked list is a linear data structure in which element is not stored in contiguous memory location and each node contain the address of previous node, the element of node and the address of next node.