Technical Interview Question
Technical Interview Question
Answer :
o The C programming language manages memory statically, automatically, or
dynamically.
o Static-duration variables are allocated in main memory, usually along with the
executable code of the program, and persist for the lifetime of the program
o Automatic-duration variables are allocated on the stack and come and go as functions
are called and return.
o For static-duration and automatic-duration variables, the size of the allocation is
required to be compile-time constant.
o Dynamic memory allocation in which memory is more explicitly (but more flexibly)
managed, typically, by allocating it from the heap, an area of memory structured for
this purpose.
o In C, the library function malloc is used to allocate a block of memory on the heap.
The program accesses this block of memory via a pointer that malloc returns. When
the memory is no longer needed, the pointer is passed to free which deallocates the
memory so that it can be used for other purposes.
Answer :
An operating system (OS) is a set of software that manages computer hardware resources and
provides common services for computer programs.
To act as interface between hardware and users, an operating system must be able
perform the following functions:
1. Enabling startup application programs. Thus, the operating system must have:
o A text editor
o A translator
o An editor of links
2. The allocation of resources needed to execute programs is done by identifying: the programs
that are running, the need for memory, peripheral devices and data protection requirements.
3. Facilities for data compression, sorting, mixing, cataloging and maintenance of libraries,
through utility programs available.
4. Plan implementation works according to certain criteria, for efficient use of central processing
unit.
5. Assisting implementation of programs through computer-user communication system, at both
hardware and software level.
Examples of operating systems:BS2000,BS3000,DOS,PC-DOS,MS-
DOS,LINUX,SOLARIS,MAC OS,UNIX,WINDOWS
Question 3. What Is The Use Of Ip Address.?
Answer :
An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g.,
computer, printer) participating in a computer network that uses the Internet Protocol for
communication. An IP address serves two principal functions: host or network interface
identification and location addressing.
Question 4. What Is Difference Between Unique And Primary Key Constraints?
Answer :
A UNIQUE constraint is similar to PRIMARY key, but you can have more than one UNIQUE
constraint per table. Contrary to PRIMARY key UNIQUE constraints can accept NULL but just
once. If the constraint is defined in a combination of fields, then every field can accept NULL
and can have some values on them, as long as the combination values is unique.
Question 5. What Are The Steps Involved In Designing?
Answer :
Project plan, Requirements, Design, Coding, Testing, Re-coding and design, Development,
Maintenance.
Answer :
Both an abstract class and an interface are specific types of computer objects that allow a
programmer to loosely define one type of object as if it were another type, while retaining all of
the object's original properties. While multiple different computer languages use one or both of
these concepts, Java is the most well-known. Abstract classes and interfaces have a variety of
similarities, but also incorporate significant differences in structure, syntax, and usage.
Answer :
SQL> delete from table_name where rowid not in (select max(rowid) from table group by
duplicate_values_field_name);
Answer :
SQL Profiler utility allows us to basically track connections to the SQL Server and also
determine activities such as which SQL Scripts are running, failed jobs etc.
Question 9. What Do You Meant By Active And Passive Objects?
Answer :
Active objects are one which instigate an interaction which owns a thread and they are
responsible for handling control to other objects. In simple words it can be referred as client.
Passive objects are one, which passively waits for the message to be processed. It waits for
another object that requires its services. In simple words it can be referred as server.
Answer :
Static modeling is used to specify structure of the objects that exist in the problem domain. These
are expressed using class, object and USECASE diagrams.
But Dynamic modeling refers representing the object interactions during runtime. It is
represented by sequence, activity, collaboration and statechart diagrams.
Answer :
Program counter holds the address of either the first byte of the next instruction to be fetched for
execution or the address of the next byte of a multi byte instruction, which has not been
completely fetched. In both the cases it gets incremented automatically one by one as the
instruction bytes get fetched. Also Program register keeps the address of the next instruction.
Answer :
CREATE procedure - is a stored procedure, which is a saved collection of Transact-SQL
statements that can take and return user-supplied parameters.
Question 13. Benefits Of Stored Procedures?
Answer :
o Reduced client/server traffic
o Efficient reuse of code and programming abstraction
o Enhanced security controls
o
Question 14. Is Xml Case-sensitive?
Answer :
XML is case sensitive when uppercase and lowercase characters are treated differently.
Element type names, Attribute names, Attribute values, All general and parameter entity names,
and data content (text), are case-sensitive.
Answer :
A property is a member that provides access to an attribute of an object or a class. Examples
of properties include the length of a string, the size of a font, the caption of a window, the
name of a customer, and so on.
Question 17. Does A Class Inherit The Constructors Of Its Super Class?
Answer :
A class does not inherit constructors from any of its super classes.
Question 18. If A Class Is Declared Without Any Access Modifiers, Where May The Class
Be Accessed?
Answer :
A class that is declared without any access modifiers is said to have package access. This means
that the class can only be accessed by other classes andinterfaces that are defined within the same
package.
Answer :
It is a process during exception handling when the destructor is called for all local objects
between the place where the exception was thrown and where it is caught.
Answer :
Precondition: A condition that should return true when a member function is invoked. In order
to use a function correctly a precondition should return true. If a precondition fails to hold, an
operation will not take responsibility to perform any action of sensibility. For example, the
interface invariants of stack class respond nothing about pushing even though the stack is already
full. In this scenario, sinful () is a precondition for push operation.
Post-Condition: A condition that should return true before returning from an invoked
function. In order to use a function correctly a post condition should return true. Taking
a stack as an example, is empty () must necessarily be true after pushing the element
into the stack when an element is pushed. The function is empty () is a post condition.
Answer :
The Document Object Model (DOM) is a cross-platform and language-independent convention
for representing and interacting with objects in HTML, XHTML and XML documents.[1]
Objects in the DOM tree may be addressed and manipulated by using methods on the objects.
The public interface of a DOM is specified in its application programming interface (API).
Answer :
Difference between overloading and overriding in programming language is:
1. In overloading, there is a relationship between methods available in the same class
whereas in overriding, there is relationship between a superclass method and subclass
method.
2. Overloading does not block inheritance from the superclass whereas overriding blocks
inheritance from the superclass.
3. In overloading, separate methods share the same name whereas in overriding, subclass
method replaces the superclass.
4. Overloading must have different method signatures whereas overriding must have
same signature.
Answer :
There are 5 operators which cannot be overloaded. They are:
1. .* - class member access operator
2. :: - scope resolution operator
3. . - dot operator
4. ?:: - conditional operator
5. Sizeof() - operator
Note:- This is possible only in C++.
Answer :
In programming languages, polymorphism means that some code or operations or objects behave
differently in different contexts.
For example, the + (plus) operator in C++:
4+5
3.14 + 2.0
s1 + "bar"
In C++, that type of polymorphism is called overloading.
Typically, when the term polymorphism is used with C++, however, it refers to using virtual
methods, which we'll discuss shortly.
Question 25. What Are The Differences Between A C++ Struct And C++ Class?
Answer :
The default member and base class access specifies are different.
The C++ struct has all the features of the class. The only differences are that a struct defaults to
public member access and public base class inheritance, and a class defaults to the private access
specifier and private base class inheritance.
Answer:
o The operating system shares the Computer's memory and sharing of the central
processing unit time by various applications and peripheral devices.
o An operating system provides a user interface, i.e., graphical user interface and
command line.
o An operating system includes functionality for booting the computer.
o Perform some basic tasks, i.e., managing the peripheral devices.
o It provides file management which refers to the way that operating system stores,
retrieves, manipulates, and saves data.
Question 27. What is the difference between UNIQUE key and PRIMARY key constraints?
Answer:
It helps to maintain a unique data in a column of a table. It helps to identify a unique row from
a table.
For MS SQL server databases, a unique constraint will generate Primary key will generate a unique
a unique NON-CLUSTERED INDEX CLUSTERED INDEX
Question 28. How can you delete the duplicate row in a table?
Answer:
In case of duplicate rows, you have to be more careful at the time of fetching records from
the table.
It is used along with a SELECT statement to eliminate all duplicate records and fetching unique
records.
Syntax:
Answer:
SQL Profiler can be defined as the profiler utility which is mainly used to track connections to
the SQL Server and also determine the activities such as which SQL Scripts are running, and
which one is getting failed, etc.
Stored procedures are a batch of SQL statements that can be executed in a couple of ways.
Most of the DBMS support stored procedures; however, not all do. The stored procedure
increases the reusability as here the code or the procedure is stored into the system and
used again and again that makes the work easy.
1. CREATE PROCEDURE procedure_name
2. AS
3. sql_statement
4. GO;
Answer:
Threads are independent that means if there is an exception in one thread, it doesn't
affect other threads. It uses a shared memory area.
The process is heavyweight and can consists of multiple threads. It is a small part of a
program.
Question 32.What is the advantages of a thread? How does the multithreading look like?
Answer:
Answer:
Multitasking: As the name indicates multiple tasks run on a single CPU. We use multitasking to
utilize the CPU.
Multi-processing: Multi-processing refers to the ability of a system to support more than one
central processing unit at the same time.
Question 34. What are stack and Queue and its applications?
Answer:
Stack
1. The stack is an ordered list in which, insertion and deletion can be performed only at one
end that is called a top.
2. The stack is a recursive data structure having a pointer to its top element.
3. Stacks are sometimes called as Last-In-First-Out (LIFO) lists, i.e., the element which is
inserted first in the stack will be deleted last from the stack.
Applications of Stack:
1. Recursion
2. Expression evaluations and conversions
3. Parsing
4. Browsers
5. Editors
6. Tree Traversals
Queue
1. A queue can be defined as an ordered list which enables insert operations to be performed
at one end called REAR and delete operations to be performed at another end called
FRONT.
2. The queue is referred to be as the First-In-First-Out list.
3. For example, people waiting in line for a rail ticket form a queue.
Applications of Queue:
1. The queues are widely used as waiting lists for a single shared resource like a printer,
disk, CPU.
2. The queues are used in the asynchronous transfer of data (where data is not being
transferred at the same rate between two processes), e.g., Pipes, file IO, sockets.
3. The queues are used as buffers in most of the applications like MP3 media player, CD
player, etc.
4. The queues are used to maintain the playlist in media players to add and remove the
songs from the playlist.
5. The queues are used in operating systems for handling interrupts.
Question 35. What is indexing, what are the advantages and disadvantages of it?
Answer:
Indexes are special lookup tables. It is used to retrieve data from the database very fast.
An Index is used to speed up select queries and where clauses. But it shows down the data input
with insert and update statements. Without affecting the data, we can create or drop indexes
Answer:
Demoralization is the process of boosting up database performance and adding of redundant data
which helps to get rid of complex data. Demoralization is a part of database optimization
technique. This process is used to avoid the use of complex and costly joins.
Demoralization doesn't refer to the thought of not to normalize instead of that demoralization
takes place after normalization. In this process, firstly the redundancy of the data will be
removed using normalization process than through demoralization process we will add redundant
data as per the requirement so that we can easily avoid the costly joins.
Answer:
A database objects use to store or reference data in the database. Any statement which is written
with CREATE Command is known as the database object.
View: This object is used to create a view in the database. It is a logical table based on another
view. A table on which view is based is called the base table.
Table: we can create a table in a database by using the CREATE TABLE statement.
Sequence: This object command used to create a sequence in the database. It is a user-created
database object which is shared by multiple users to generate unique integers.
Index: A database object can create indexes in the database by using an index. Indexes are used
for fast retrieval of rows from a table.
Synonym: This object is also used for creating indexes in the database. By synonym, you can
easily access the objects
Question 38. What are Self-Join and Outer Join, where do you use it?
Answer:
Self-Join: A self-join is a join which joins the table with itself, means that each row of the table
is combined with itself and with every other row of the table. The table contains a FOREIGN
KEY which references its PRIMARY KEY.
Now come to SQL outer join, all the content of both tables is integrated together either they are
matched or not.
1. Left outer join (also known as left join): this join returns all the rows from left table combine
with the matching rows of the right table. If you get no matching in the right table, it returns
NULL values.
o SELECT table1.column1, table2.column2.....
o FROM table1
o LEFTJOIN table2
o ON table1.column_field = table2.column_field;
2. Right outer join (also known as right join): this join returns all the rows from right table are
combined with the matching rows of left table .If you get no column matching in the left table .it
returns null value.
o SELECT table1.column1, table2.column2.....
o FROM table1
o RIGHT JOIN table2
o ON table1.column_field = table2.column_field;
Question 38. Define memory management in C.
Answer:
When you run a program, it loads into your computer memory and starts execution by sending
and receiving the instructions from the computer's processor. When your program needs to run a
function, then it loads at another part of the memory till it runs and releases that memory when
the task is complete.
Now, talk about the concept of dynamic memory allocation in c language, which enables the
C programmer to allocate memory at runtime. Dynamic memory allocation in c language is
possible by four functions of stdlib.h header file.
1. malloc()
2. calloc()
3. realloc()
4. free()
Question 39. What are the steps involved in designing complete software?
Answer:
Question 40. What is the difference between Abstract classes and interface?
Answer:
Java interface should be implemented using the keyword "implements"; A Java abstract
class should be extended using the keyword "extends."
An Interface can extend interface only; Abstract class have two properties, it can extend
only one java class but implement more than one interface at a time.
Answer:
We can define property in a way that property is a member of a class that provides the access of
an object or a class to an attribute. For e.g., Properties include the length of a string, the size of a
font, the caption of a window, the name of a customer, and so on.
Answer:
A pre-condition is a condition that must be true before a method runs for it to work
If all the preconditions of this method are satisfied, then postconditions will also meet for the
same method.
Question 43. How can you sort the elements of an array in ascending order?
Answer:
1. #include<stdio.h>
2. include<conio.h>
3. void main()
4. {
5.
6. int i, j, a, m, num[30];
7. printf("Enter the value of N \n");
8. scanf("%d", &m);
9.
10. printf("Enter the numbers \n");
11. for (i = 0; i < m; ++i)
12. scanf("%d", &num[i]);
13.
14. for (i = 0; i < m; ++i)
15. {
16.
17. for (j = i + 1; j < m; ++j)
18. {
19.
20. if (num[i] > num[j])
21. {
22.
23. a = num[i];
24. num[i] = num[j];
25. num[j] = a;
26.
27. }
28.
29. }
30.
31. }
32.
33. printf("Ascending order of elements \n");
34. for (i = 0; i < m; ++i)
35. printf("%d\n", num[i]);
36.
37. }
Answer:
Macros can define before the main method or within the main method. Macros are pre-processed
that means all the macros are processed before the compilation of the program, and the functions
are processed after compilation of the program.
For example:
1. #include<stdio.h>
2. #include<conio.h>
3. #define NUM 10 //Macro
4. int main()
5. {
6. printf("%d", NUM);
7. return 0;
8. }
Answer:
Answer:
Answer:
A struct is a bundle. It is a combination of all related elements that need to work together in a
particular context. Such as, the restricted number of arguments context can pass to a function:
If you don't specify the access modifier, visibility (public, private or protected) of the members
will be public in the struct and private in the class.
The visibility by default goes just a little further than members: for inheritance, if you don't
specify anything then the struct will inherit publicly from its base class, while the class will do
private inheritance:
Question 47. What is the rule for a catch or declare method declarations?
Answer:
Catch block catches any exception that results from the try block. If a checked exception is
thrown within the body of the method, the thrown exception must be caught by the method
(with the help of try/catch block) or declare it in its throws clause.
Question 48. What is the top class of the AWT Event Hierarchy?
Answer:
Question 49. When is a thread created and started, what is its initial state?
Answer:
A thread is created and started with its Initial state called "ready" state where a thread is ready to
run.
Answer:
Yes, an anonymous class can extend its super class or implement an interface but cannot use
both simultaneously.
Question 51. Define Synchronization and why is it important?
Answer:
Hence, Java Synchronization is a better option for restriction. i.e., It allows only one
thread to access the shared resource.
Answer:
Answer:
The entire task can't execute simultaneously so that a scheduler assign priorities to all
tasks for its execution. Priorities can be high or low depending on the task's importance,
and the integer values determine it.
Answer:
Data abstraction in DBMS is a process of hiding irrelevant details from users. Because
database systems are made of complex data structures, so it makes accessible the user
interaction with the database.
Following are three levels of data abstraction:
Physical level: It is the lowest level of abstraction. It describes how data are stored.
Logical level: It is the next higher level of abstraction. It describes what data are stored
in the database and what the relationship among those data is.
View level: It is the highest level of data abstraction. It describes only part of the entire
database.
Answer:
Hashing is a faster searching technique. The process of mapping a large amount of data
item to a smaller table with the help of a hashing function is called hashing. In other
words, hashing is a technique to convert a range of key values into a range of indexes of
an array.
In terms of java: Hashing is a way to assign a unique code for any variable or object
after applying any function or algorithm on its properties.
Answer: