Hot Topics
Larsen & Turbo Solution
Technical Round
- Question 1
Explain your current project.
- Answer
Explain Your project.
- Question 2
Public int compare To(object o) { Employee emp = (Employee)o; return this.id – e.id; }
- Answer
This is a Java method for comparing two objects of the “Employee” class, based on their “id” field. The method takes an object “o” as an argument, casts it to an “Employee” object, and compares the “id” field of the current object to the “id” field of the “Employee” object “emp”. The method returns the difference between the two “id” fields, with a negative value indicating that the current object’s “id” is less than the “emp” object’s “id”, a positive value indicating that the current object’s “id” is greater than the “emp” object’s “id”, and zero indicating that the two “id” fields are equal.
- Question 3
Can we use return statement in finally block if yes then how its work if not then why?
- Answer
Yes, you can use a return statement in a finally block in Java. However, if a return statement is present in both the try block and the finally block, the value returned by the finally block will overwrite the value returned by the try block.
The finally block is executed after the try block and any catch blocks, regardless of whether an exception was thrown or not. This means that the finally block is guaranteed to be executed, even if an exception is thrown or a return statement is executed in the try block.
Therefore, if the finally block contains a return statement, that return statement will overwrite any previous return statement in the try block and will be the final value returned by the method. This is why it’s important to use a return statement in the finally block with caution, as it can change the expected behavior of the method.
- Question 4
Write a code for the output 1 12 123 1234.
- Answer
#include<stdio.h>
int main(){
int row,col,n;
scanf("%d",&n);
for (row = 1; row <= n; row++)
{
for (col = 1; col <= row; col++)
{
printf("%d",col);
}
printf("\n");
}
}
/*
output:
4
1
12
123
1234
*/
- Question 5
Which was your most difficult program assignment u have done in whole engineering?
- Answer
If you have faced this type of any situation tell them.
- Question 6
Can you create graph using c.
- Answer
Yes, it is possible to create graphs using the C programming language. There are several libraries available for creating graphs in C, including the Graphics Device Interface (GDI) and the Simple DirectMedia Layer (SDL).
To create a graph using GDI, you will need to use the Windows API to create a window and draw on it. To create a graph using SDL, you will need to initialize the library, create a window, and use the library’s drawing functions to create your graph.
Here’s a simple example of how you can create a graph using SDL in C:
#include <SDL2/SDL.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *window = SDL_CreateWindow("Graph Example",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640, 480, 0);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDL_RenderDrawLine(renderer, 0, 240, 640, 240);
SDL_RenderDrawLine(renderer, 320, 0, 320, 480);
SDL_RenderPresent(renderer);
SDL_Delay(5000);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
This code creates a window, initializes a renderer, sets the color to white, and draws two lines to create a simple x-y axis. The graph is displayed for 5 seconds before being destroyed.
- Question 7
What is the difference between interfaces and abstract class?
- Answer
Interface | Abstract class |
1. Interface supports the concept of multiple inheritance. | Abstract class doesn’t support the concept of multiple inheritance. |
2. Interface has only abstract methods. | Abstract class can have non-abstract method but it must have at least one abstract method. |
3. Interface keyword is used to declare interface | Abstract keyword is used to declare Abstract class. |
4. Interface has members as public by default. | Abstract class in Java can have private, protected, public and default class members. |
5. Interface supports multiple inheritance. | Abstract class does not support multiple inheritance. |
- Question 8
Explain OOPS concept in C++. Give advantages of the same.
- Answer
Object-Oriented Programming (OOP) is a programming paradigm that focuses on objects, which are instances of classes, and the relationships between these objects. OOP is based on the concept of inheritance, encapsulation, polymorphism, and abstraction.
C++, being an object-oriented language, supports OOP concepts and provides several features to implement them, including:
Class: A class is a blueprint for creating objects (a particular data structure), providing initial values for state (member variables or attributes), and implementations of behavior (member functions or methods).
Objects: An object is an instance of a class. Each object has its own state and behavior.
Inheritance: Inheritance is a mechanism of deriving a new class from an existing class. The new class is called the derived class, and the existing class is called the base class.
Polymorphism: OOP provides polymorphism, which allows objects of different classes to be used interchangeably, providing a more flexible and dynamic approach to programming.
Inheritance: OOP provides inheritance, which allows you to create new classes based on existing classes, making it easier to extend existing code and reuse existing functionality.
Overall, OOP provides a structured and organized approach to software development, making it easier to maintain and modify code, and providing better support for creating complex applications.
- Question 9
Tell me about your final year project
- Answer
Tell about your project.
- Question 10
Insertion and deletion of elements is easier in array or linked list?
- Answer
Linked Lists are dynamic hence insertion and deletion of elements is easier there.
- Question 11
What are joins in DBMS?
- Answer
Joins are used to combine two tables based on a specified common field between them.
- Question 12
Rate your programming skills, DBMS skills, web technology skills out of five?
- Answer
Rate yourself according to your knowledge on the following technologies.
- Question 13
How did you connect Servlet to DBMS?
- Answer
A Servlet can connect to a database management system (DBMS) using the Java Database Connectivity (JDBC) API. JDBC provides a standard interface for connecting to a variety of databases, including relational databases like MySQL, Oracle, and PostgreSQL.
- Question 14
Explain JOIN queries using vein diagram?
- Answer
A Venn diagram is a type of diagram that uses overlapping circles to represent the relationship between different sets of data. In the context of database join queries, a Venn diagram can be used to visually represent how the data from two or more tables are combined.
Here’s an example of how you can use a Venn diagram to explain the different types of join queries:
Inner Join: An inner join returns only the rows that have matching values in both tables. The result set includes only the rows where there is a match in both tables. This can be represented using a Venn diagram as the overlap between the two circles, representing the data in the two tables.
Left Join (or Left Outer Join): A left join returns all the rows from the left table (the first table in the join clause), and the matching rows from the right table (the second table in the join clause). If there is no match in the right table, the result set includes NULL values for the columns from the right table. This can be represented using a Venn diagram as the left circle representing the data in the left table, and the overlap with the right circle representing the matching data in the right table.
Right Join (or Right Outer Join): A right join is similar to a left join, but it returns all the rows from the right table and the matching rows from the left table. If there is no match in the left table, the result set includes NULL values for the columns from the left table. This can be represented using a Venn diagram as the right circle representing the data in the right table, and the overlap with the left circle representing the matching data in the left table.
Full Outer Join: A full outer join returns all the rows from both tables, including the matching rows and the non-matching rows. If there is no match in one of the tables, the result set includes NULL values for the columns from the non-matching table. This can be represented using a Venn diagram as the union of the two circles, representing the data in both tables.
These are the basic concepts of join queries and how they can be represented using Venn diagrams. In a real-world scenario, you would use join queries to combine data from multiple tables to retrieve the information you need.