SlideShare uma empresa Scribd logo
1 de 55
 In technical interview, interviewer has the liberty
to ask any question related to computer science.
 Normally they ask for current technologies, some
core technologies and most importantly the
domain on which company is working.
 So before, preparing for interview for any
company, check out its profile, areas of interests,
domain and other important things.
 Interviewer expects that you are fundamentally
sound in some basic aspects of computer
engineering.
 Always prepare one or two subjects completely
that you are interested in and want to work on.
 But those subjects must be conceptually clear to
you, because interviewer will pose difficult
questions related to those subjects.
 Always be prepared to face the questions
regarding project work you’ve done
throughout the engineering. ( A good point to
score)
 Sometimes it is good to have some information
about latest technologies and innovations.
 C Programming language.
 C++ and Object Oriented Concepts
 Basics of Data Structure and Algorithms
 Basics of Analysis of Algorithms
 Database Management System
 Operating System
 Basics of Networks
 One or more programming Language
(.NET/Java/PHP/HTML/Python/Perl/..)
 C is a general-purpose programming language
initially developed by Dennis Ritchie between 1969
and 1973 at Bell Labs.
 C is an imperative (procedural) language. It was
designed to be compiled using a relatively
straightforward compiler, to provide low-level
access to memory, to provide language constructs
that map efficiently to machine instructions, and to
require minimal run-time support.
 C was therefore useful for many applications that
had formerly been coded in assembly language,
such as in system programming.
 A C program, whatever its size, consists of
functions and variables. A function contains
statements that specify the computing operations to
be done, and variables store values used during
the computation.
 The basic C source character set includes the
following characters:
 Letters: a–z, A–Z, _
 Digits: 0–9
 Punctuation: ~ ! @ # % ^ & * ( ) - + = : ; " ' < > , . ? | /  { }
[ ]
 Whitespace characters: space, horizontal tab, vertical tab,
form feed, newline
 Block scope : variables are accessible within the block in which they are
declared.
 Function scope: variables are accessible within the function they are
declared.
 File scope: A variable with file scope can be accessed by any function or
block within a single file. To declare a file scoped variable, simply declare
a variable outside of a block (same as a global variable) but use the static
keyword.
 Program scope: Variables with program scope are also called global
variables, which are visible among different files. These files are the entire
source files that make up an executable program.
static int nValue; // file scoped variable
Float fValue; // global variable
int main()
{
double dValue; // local variable
}
 The auto specifier: The auto specifier indicates that the memory
location of a variable is temporary. In other words, a variable's
reserved space in the memory can be erased or relocated when the
variable is out of its scope.
 The static specifier: When a variable within a function is declared
with the static specifier, the variable has a permanent duration. In
other words, the memory storage allocated for the variable is not
destroyed when the scope of the variable is exited, the value of the
variable is maintained outside the scope, and if execution ever
returns to the scope of the variable, the last value stored in the
variable is still there.
 The register specifier: Each computer has a certain number of
registers to hold data and perform arithmetic or logical
calculations. Because registers are located within the CPU (central
processing unit) chip, it's much quicker to access a register than a
memory location. Therefore, storing variables in registers may
help to speed up your program.
 The extern specifier: How can a global variable declared in
file A, for instance, be seen in file B? In other words, how
does the compiler know that the variable used in file B is
actually the same variable declared in file A?
 The answer is: Use the extern specifier provided by the C
language to allude to a global variable defined elsewhere.
 The const modifier: If you declare a variable with the const
modifier, the content of the variable cannot be changed after
it is initialized.
 The volatile modifier: If you want to let the compiler know
that the value of a variable can be changed without an
explicit assignment statement, declare the variable with the
volatile modifier so that the compiler will turn off
optimizations on expressions involving the variable.
 In C, pass by value is the mechanism used to pass parameters into
a function. A copy is made of the variable and that copy is used.
 Because a copy is used, the function cannot alter variables that are
passed in. Parameters only pass values in, not out. This is called
Pass by Value.
 One way to allow functions to modify the value of argument is by
using pass by reference. In pass by reference, we declare the
function parameters as references rather than normal variables:
void AddOne(int &y) // y is a reference variable
{
y = y + 1;
}
 The above pass by reference concept is valid in C++. So how to
pass by reference in C?
 Pointers "point" to locations in memory. Pointers
are just variables that store memory addresses,
usually the addresses of other variables.
 In order to have a pointer actually point to another
variable it is necessary to have the memory
address of that variable also. To get the memory
address of a variable (its location in memory), put
the & sign in front of the variable name.
 *p performs the "dereferencing" operation on p; it
looks at the address stored in p, and goes to that
address and returns the value.
 Pointers allow you to implement sharing without copying i.e. pass by
reference v/s pass by copying. This allows a tremendous advantage when
you are passing around big arrays as arguments to functions.
 Pointers allow us to use dynamic memory allocation.
 Pointers obviously give us the ability to implement complex data
structures like linked lists, trees, etc.
 Pointers allow ease of programming, especially when dealing with
strings. This is due to the fact that a pointer increment will move by the
size of the pointee i.e. easy coding to increment to the next memory
location of an array, without worrying about how many bytes to move for
each data type. I.e. a pointer to a char will move the pointer by a byte,
pointer to an int, by the size of the int, etc. NOTE that this is important
because you do not have to worry about the size of the data types which
can vary on different architectures.
 Pointers allow us to resize the data structure whenever needed. For
example, if you have an array of size 10, it cannot be resized. But, an array
created out of malloc and assigned to a pointer can be resized easily by
creating a new memory area through malloc and copying the old contents
over. This ability is very important in implementing sparse data
structures also.
 malloc, calloc, or realloc are the three functions used to
manipulate memory. These commonly used functions are
available through the stdlib library so you must include this
library in order to use them.
 When a program executes, the operating system gives it a
stack and a heap to work with. The stack is where global
variables, static variables, and functions and their locally
defined variables reside. The heap is a free section for the
program to use for allocating memory at runtime.
 Allocating a Block of Memory : Use the malloc function to
allocate a block of memory for a variable. If there is not
enough memory available, malloc will return NULL.
 The prototype for malloc is:
 void *malloc(size_t size);
 Allocating Multiple Blocks of Memory
 You can also ask for multiple blocks of memory with the calloc
function:
 void *calloc(size_t num, size_t size);
 Releasing the Used Space
 All calls to the memory allocating functions discussed here, need
to have the memory explicitly freed when no longer in use to
prevent memory leaks. Just remember that for every call to an
*alloc function you must have a corresponding call to free.
 free(ptr);
 To Alter the Size of Allocated Memory: We can use realloc
function to alter the size of allocated memory.
 void *realloc(void *ptr, size_t size);
 Pass this function the pointer to the memory you want to resize
and the new size you want to resize the allocated memory for the
variable you want to resize.
 Structures in C are used to encapsulate, or group together different data
into one object. When you define a structure or union, you are creating a
custom data type.
struct object {
char id[20];
int xpos;
int ypos;
};
 Unions and Structures are identical in all ways, except for one very
important aspect. Only one element in the union may have a value set at
any given time. Everything we have shown you for structures will work
for unions, except for setting more than one of its members at a time.
 Unions are mainly used to conserve memory. While each member within
a structure is assigned its own unique storage area, the members that
compose a union share the common storage area within the memory.
 Unions are useful for application involving multiple members where
values are not assigned to all the members at any one time.
 Rich operator set of C. (most importantly
bitwise operators, logical operators)
 Basic instruction set of C (including loops,
break, continue, goto, switch, etc.)
 Bit of File I/O. (some knowledge of fopen,
fclose, fwrite, fread, etc.)
 Some knowledge about type casting in C.
 Bit of command line arguments.
 C follows the procedural programming paradigm
while C++ is a multi-paradigm
language(procedural as well as object oriented)
 In case of C, the data is not secured while the data
is secured(hidden) in C++
 C is a low-level language while C++ is a middle-
level language
 C++ supports function overloading while C does
not
 We can use functions inside structures in C++ but
not in C.
 C++ allows the use of reference variables while C
does not
CLASS
 A class is an expanded concept of a data structure: instead of
holding only data, it can hold both data and functions.
 An object is an instantiation of a class. In terms of variables, a
class would be the type, and an object would be the variable.
 An access specifier is one of the following three keywords:
private, public or protected. These specifiers modify the
access rights that the members following them acquire:
 private members of a class are accessible only from within
other members of the same class or from their friends.
 protected members are accessible from members of their
same class and from their friends, but also from members of
their derived classes.
 public members are accessible from anywhere where the
object is visible.
 Objects generally need to initialize variables or assign dynamic memory
during their process of creation to become operative and to avoid
returning unexpected values during their execution.
 class can include a special function called constructor, which is
automatically called whenever a new object of this class is created. This
constructor function must have the same name as the class, and cannot
have any return type; not even void.
 Constructors cannot be called explicitly as if they were regular member
functions. They are only executed when a new object of that class is
created.
 The destructor fulfils the opposite functionality. It is automatically called
when an object is destroyed, either because its scope of existence has
finished (for example, if it was defined as a local object within a function
and the function ends) or because it is an object dynamically assigned and
it is released using the operator delete.
 The destructor must have the same name as the class, but preceded with a
tilde sign (~) and it must also return no value.
 Encapsulation is the process of combining data and
functions into a single unit called class. Using the
method of encapsulation, the programmer cannot
directly access the data.
 Data is only accessible through the functions existing
inside the class.
 The key strength behind Data Encapsulation in C++ is
that the keywords or the access specifiers can be placed
in the class declaration as public, protected or private.
 Advantages of encapsulation
 Makes Maintenance of Application Easier
 Improves the Understandability of the Application
 Enhanced Security
 C++ allows you to specify more than one definition for a
function name or an operator in the same scope, which is
called function overloading and operator overloading
respectively.
 An overloaded declaration is a declaration that had been
declared with the same name as a previously declared
declaration in the same scope, except that both declarations
have different arguments.
 When you call an overloaded function or operator, the
compiler determines the most appropriate definition to use
by comparing the argument types you used to call the
function or operator with the parameter types specified in
the definitions.
 The process of selecting the most appropriate overloaded
function or operator is called overload resolution.
 #include <iostream>
using namespace std;
class printData {
public:
void print(int i)
{ cout << "Printing int: " << i << endl; }
void print(double f)
{ cout << "Printing float: " << f << endl; }
void print(char* c)
{ cout << "Printing character: " << c << endl; }
};
int main(void)
{
printData pd;
// Call print to print integer
pd.print(5);
// Call print to print float
pd.print(500.263);
// Call print to print character
pd.print("Hello C++");
return 0;
}
 #include <iostream>
using namespace std;
class Box
{
double length; // Length of a box
double breadth; // Breadth of a box
double height; // Height of a box
public:
double getVolume(void)
{ return length * breadth * height; }
void setLength( double len )
{ length = len; }
void setBreadth( double bre )
{ breadth = bre; }
void setHeight( double hei )
{ height = hei; }
 // Overload + operator to add two Box objects.
Box operator+(const Box& b)
{
Box box;
box.length = this->length + b.length;
box.breadth = this->breadth + b.breadth;
box.height = this->height + b.height;
return box;
}
};
// Add two object as follows:
Box3 = Box1 + Box2;
 The word polymorphism means having many
forms. Typically, polymorphism occurs when
there is a hierarchy of classes and they are
related by inheritance.
 C++ polymorphism means that a call to a
member function will cause a different function
to be executed depending on the type of object
that invokes the function.
 A member of a class that can be redefined in its
derived classes is known as a virtual member. In
order to declare a member of a class as virtual, we
must precede its declaration with the keyword
virtual.
 Therefore, what the virtual keyword does is to
allow a member of a derived class with the same
name as one in the base class to be appropriately
called from a pointer, and more precisely when the
type of the pointer is a pointer to the base class but
is pointing to an object of the derived class, as in
the above example.
 A class that declares or inherits a virtual function is
called a polymorphic class.
 // virtual members #include <iostream>
using namespace std;
class CPolygon {
protected: int width, height;
public:
void set_values (int a, int b)
{ width=a; height=b; }
virtual int area ()
{ return (0); }
};
class CRectangle: public CPolygon
{
public: int area ()
{ return (width * height); }
};
class CTriangle: public CPolygon
{
public: int area ()
{ return (width * height / 2); }
};
int main ()
{
CRectangle rect;
CTriangle trgl;
CPolygon poly;
CPolygon * ppoly1 = &rect;
CPolygon * ppoly2 = &trgl;
CPolygon * ppoly3 = &poly;
ppoly1->set_values (4,5);
ppoly2->set_values (4,5);
ppoly3->set_values (4,5);
cout << ppoly1->area() << endl;
cout << ppoly2->area() << endl;
cout << ppoly3->area() << endl;
return 0;
}
The use of virtual functions is Dynamic Binding.
 Classes that contain at least one pure virtual function are
abstract base classes.
 To make a pure virtual function, append =0 (equal to zero)
to the function declaration.
 virtual int area () =0;
 The main difference between an abstract base class and a
regular polymorphic class is that because in abstract base
classes at least one of its members lacks implementation we
cannot create instances (objects) of it.
 However, pointers to this abstract base class can be used to
point to objects of derived classes.
 Abstract Base Class in C++ concept is similar to concept of
interfaces in Java.
 Inheritance allows us to define a class in terms of
another class, which makes it easier to create and
maintain an application. This also provides an
opportunity to reuse the code functionality and
fast implementation time.
 When creating a class, instead of writing
completely new data members and member
functions, the programmer can designate that the
new class should inherit the members of an
existing class. This existing class is called the base
class, and the new class is referred to as the
derived class.
 Syntax to inherit a class:
 class derived-class: access-specifier base-class
 We can summarize the different access types according to who can
access them in the following way:
 A derived class inherits all base class methods with the following
exceptions:
 Constructors, destructors and copy constructors of the base class.
 Overloaded operators of the base class.
 The friend functions of the base class.
Access public protected private
Same class yes yes yes
Derived classes yes yes no
Outside classes yes no no
 A friend function for a class is used in object-oriented
programming to allow access to public, private, or
protected data in the class from the outside. Normally,
a function that is not a member of a class cannot access
such information; neither can an external class.
 A friend function is declared by the class that is
granting access.
 When a function needs to access private data in objects
from two different classes. This may be accomplished
in two similar ways
 a function of global or namespace scope may be declared as
friend of both classes
 a member function of one class may be declared as friend of
another one.
C++ Java
Write once, compile anywhere
(WOCA).
Write once, run anywhere /
everywhere (WORA / WORE).
Allows procedural programming,
functional programming, object-
oriented programming.
Strongly encourages an object-
oriented programming paradigm.
Explicit memory management. Automatic garbage collection (can be
triggered manually).
Pointers, references, and pass-by-
value are supported.
Primitive and reference data types
always passed by value.
Full Multiple inheritance. From classes, only single inheritance is
allowed. From Interfaces, Multiple
inheritance is also allowed.
Exposes low-level system facilities. Runs in a virtual machine. Does not
always provide full access to the
features and performance of the
platform on which the software runs.
 Platform Independent
 Simple
 Object Oriented
 Robust
 Portable
 Secure
 Performance
 Multithreaded
 Interpreted
 One characteristic of Java is portability, which means that
computer programs written in the Java language must run
similarly on any hardware/operating-system platform.
 This is achieved by compiling the Java language code to an
intermediate representation called Java bytecode, instead of
directly to platform-specific machine code.
 Java bytecode instructions are analogous to machine code,
but are intended to be interpreted by a virtual machine (VM)
written specifically for the host hardware.
 The overhead of interpretation means that interpreted
programs almost always run more slowly than programs
compiled to native executables would. Just-in-Time (JIT)
compilers were introduced from an early stage that compile
bytecodes to machine code during runtime.
 Java has the strong memory allocation and
automatic garbage collection mechanism.
 It provides powerful exception handling and
type checking mechanism as compare to other
programming languages.
 Compiler checks the program whether there
any error and interpreter checks any run time
error and makes the system secure from crash.
 Java does not use memory pointers explicitly.
All the programs in java are run under an area
known as the sand box.
 The JVM's heap stores all objects created by an
executing Java program. Objects are created by Java's
"new" operator, and memory for new objects is
allocated on the heap at run time.
 Garbage collection is the process of automatically
freeing objects that are no longer referenced by the
program.
 In the process of freeing unreferenced objects, the
garbage collector must run any finalizers of objects
being freed.
 In Java on calling System.gc() and Runtime.gc(), JVM
tries to recycle the unused objects, but there is no
guarantee when all the objects will garbage collected.
 Multithreading is a technique that allows a
program or a process to execute many tasks
concurrently (at the same time and parallel). It
allows a process to run its tasks in parallel mode
on a single processor system.
 Advantages of multithreading over
multitasking:
 Reduces the computation time.
 Improves performance of an application.
 Threads share the same address space so it saves the
memory.
 Context switching between threads is usually less
expensive than between processes.
 Cost of communication between threads is relatively low.
 The Java collections framework (JCF) is a set
of classes and interfaces that implement
commonly reusable collection data structures.
 There are three main types of collections:
 Lists: always ordered, may contain duplicates and
can be handled the same way as usual arrays
 Sets: cannot contain duplicates and provide random
access to their elements
 Maps: connect unique keys with values, provide
random access to its keys and may host duplicate
values
 An exception is a problem that arises during the execution of a program.
An exception can occur for many different reasons, including the
following:
 A user has entered invalid data.
 A file that needs to be opened cannot be found.
 A network connection has been lost in the middle of communications,
or the JVM has run out of memory.
 Checked exceptions: A checked exception is an exception that is typically
a user error or a problem that cannot be foreseen by the programmer. For
example, if a file is to be opened, but the file cannot be found, an
exception occurs. These exceptions cannot simply be ignored at the time
of compilation.
 Runtime exceptions: A runtime exception is an exception that occurs that
probably could have been avoided by the programmer. As opposed to
checked exceptions, runtime exceptions are ignored at the time of
compilation.
 Errors: These are not exceptions at all, but problems that arise beyond the
control of the user or the programmer. Errors are typically ignored in
your code because you can rarely do anything about an error. For
example, if a stack overflow occurs, an error will arise. They are also
ignored at the time of compilation.
 Java I/O
 Networking in Java
 Event Handling in Java
 Applets and AWT framework
 Little knowledge about SWING framework
 Generics in Java
 Data structure is a particular way of storing and organizing data
in a computer so that it can be used efficiently.
 Different kinds of data structures are suited to different kinds of
applications, and some are highly specialized to specific tasks.
 Some Examples:
 Arrays
 Structures
 Stacks
 Queues
 Heaps
 Linked Lists
 Graphs
 Trees
 Hash Tables
 Tries
 An operating system (OS) is a collection of
software that manages computer hardware
resources and provides common services for
computer programs.
 Kernel Architectures.
 Memory management.
 Thread vs. Process.
 Concurrency Control Mechanism.
 Cache Memory.
 Four broad categories of kernels:
 Monolithic kernels provide rich and powerful
abstractions of the underlying hardware.
 Microkernels provide a small set of simple hardware
abstractions and use applications called servers to
provide more functionality.
 Exokernels provide minimal abstractions, allowing low-
level hardware access. In exokernel systems, library
operating systems provide the abstractions typically
present in monolithic kernels.
 Hybrid (modified microkernels) are much like pure
microkernels, except that they include some additional
code in kernel space to increase performance.
 The memory management function keeps track
of the status of each memory location, either
allocated or free.
 It determines how memory is allocated among
competing processes, deciding who gets
memory, when they receive it, and how much
they are allowed.
 When memory is allocated it determines
which memory locations will be assigned. It
tracks when memory is freed or unallocated and
updates the status.
 Single contiguous allocation: All the computer's memory, usually
with the exception of a small portion reserved for the operating
system, is available to the single application.
 Partitioned allocation: Partitioned allocation divides primary
memory into multiple memory partitions, usually contiguous areas
of memory. Each partition might contain all the information for a
specific job or task. Memory management consists of allocating a
partition to a job when it starts and unallocating it when the job
ends.
 Paged memory management: Paged allocation divides the
computer's primary memory into fixed-size units called page
frames, and the program's address space into pages of the same size.
The hardware memory management unit maps pages to frames.
 Segmented memory management: Segments are areas of memory
that usually correspond to a logical grouping of information such
as a code procedure or a data array.
 Virtual Memory
Threads Process
thread of execution is the smallest
unit of processing that can be
scheduled by an operating system.
a process is an instance of a computer
program that is being executed.
Process can have multiple threads.
Sharing data among threads is trivial
because threads share the same
memory. (However, great care must
be taken to avoid race conditions, as
described previously.)
Sharing data among processes
requires the use of IPC mechanisms.
Advantage of a multithreaded
program allows it to operate faster on
computer systems that have multiple
CPUs, CPU s with multiple cores, or
across a cluster of machines —
because the threads of the program
naturally lend themselves to truly
concurrent execution.
 Concurrency control ensures that correct results
for concurrent operations are generated, while
getting those results as quickly as possible.
 Techniques of concurrency control in Database
Systems:
 Two Phase Locking Protocol
 Precedence Graph
 Timestamp Ordering
 Techniques of concurrency control in Operating
Systems:
 Semaphores
 Monitors
 Primary storage: Main memory is directly or
indirectly connected to the central processing
unit via a memory bus.
 Secondary storage: The computer usually uses
its input/output channels to access secondary
storage and transfers the desired data using
intermediate area in primary storage.
 Cache Memory: The cache is a smaller, faster
memory which stores copies of the data from
the most frequently used main memory
locations.
 First Step: Create a program in editor.
 #include<stdio.h>
void main()
{
printf(―Hello World‖);
}
 Second Step: Compile the Program (gcc hello.c)
 When we call compiler, before compiling
preprocessing takes place.
 So all the preprocessor directives are expanded.
 After Preprocessing source code is compiled.
 Compilation Process:
 The front end checks whether the program is
correctly written in terms of the programming
language syntax and semantics.
 The middle end is where optimization takes place.
Typical transformations for optimization are
removal of useless or unreachable code.
 The back end is responsible for translating the IR
from the middle-end into assembly code.
 Still, the external references to library code is
remaining.
 Here comes Linking:
 When a program comprises multiple object files, the
linker combines these files into a unified executable
program, resolving the symbols as it goes along.
 One or more system libraries are usually linked in by
default.
 After linking pass, we get an executable which
is ready to be executed.
 Now, to execute that executable it is to be
loaded into main memory.
 So next comes Loader
 Loading a program involves reading the contents of
executable file, the file containing the program text,
into memory, and then carrying out other required
preparatory tasks to prepare the executable for
running.
 Once loading is complete, the operating system
starts the program by passing control to the
loaded program code.
 BEST OF LUCK
 Thank You

Mais conteúdo relacionado

Mais procurados

Java j2ee interview_questions
Java j2ee interview_questionsJava j2ee interview_questions
Java j2ee interview_questions
ppratik86
 
Extreme Interview Questions
Extreme Interview QuestionsExtreme Interview Questions
Extreme Interview Questions
Ehtisham Ali
 
3.java database connectivity
3.java database connectivity3.java database connectivity
3.java database connectivity
web360
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging API
white paper
 

Mais procurados (16)

Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
 
Java j2ee interview_questions
Java j2ee interview_questionsJava j2ee interview_questions
Java j2ee interview_questions
 
Best interview questions
Best interview questionsBest interview questions
Best interview questions
 
Extreme Interview Questions
Extreme Interview QuestionsExtreme Interview Questions
Extreme Interview Questions
 
Hibernate Advance Interview Questions
Hibernate Advance Interview QuestionsHibernate Advance Interview Questions
Hibernate Advance Interview Questions
 
3.java database connectivity
3.java database connectivity3.java database connectivity
3.java database connectivity
 
Hibernate notes
Hibernate notesHibernate notes
Hibernate notes
 
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetDev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdet
 
Spring - Part 3 - AOP
Spring - Part 3 - AOPSpring - Part 3 - AOP
Spring - Part 3 - AOP
 
Top 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed AnswersTop 100 Java Interview Questions with Detailed Answers
Top 100 Java Interview Questions with Detailed Answers
 
Elements of Java Language
Elements of Java Language Elements of Java Language
Elements of Java Language
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
 
Complete placement guide(technical)
Complete placement guide(technical)Complete placement guide(technical)
Complete placement guide(technical)
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging API
 

Semelhante a Technical Interview

C basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kellaC basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kella
Manoj Kumar kothagulla
 
C interview question answer 1
C interview question answer 1C interview question answer 1
C interview question answer 1
Amit Kapoor
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
urvashipundir04
 

Semelhante a Technical Interview (20)

C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
C programming session7
C programming  session7C programming  session7
C programming session7
 
C programming session7
C programming  session7C programming  session7
C programming session7
 
What is c language
What is c languageWhat is c language
What is c language
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
 
cs8251 unit 1 ppt
cs8251 unit 1 pptcs8251 unit 1 ppt
cs8251 unit 1 ppt
 
C basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kellaC basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kella
 
Bcsl 031 solve assignment
Bcsl 031 solve assignmentBcsl 031 solve assignment
Bcsl 031 solve assignment
 
C interview question answer 1
C interview question answer 1C interview question answer 1
C interview question answer 1
 
object oriented programming part inheritance.pptx
object oriented programming part inheritance.pptxobject oriented programming part inheritance.pptx
object oriented programming part inheritance.pptx
 
C++ programing lanuage
C++ programing lanuageC++ programing lanuage
C++ programing lanuage
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
 
OODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objectsOODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objects
 
Unit 1
Unit  1Unit  1
Unit 1
 
Basic Information About C language PDF
Basic Information About C language PDFBasic Information About C language PDF
Basic Information About C language PDF
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
 
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++  Langauage Training in Ambala ! BATRA COMPUTER CENTREC++  Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
 
Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptx
 
Lecture 3.mte 407
Lecture 3.mte 407Lecture 3.mte 407
Lecture 3.mte 407
 
venkatesh.pptx
venkatesh.pptxvenkatesh.pptx
venkatesh.pptx
 

Último

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

Technical Interview

  • 1.
  • 2.  In technical interview, interviewer has the liberty to ask any question related to computer science.  Normally they ask for current technologies, some core technologies and most importantly the domain on which company is working.  So before, preparing for interview for any company, check out its profile, areas of interests, domain and other important things.  Interviewer expects that you are fundamentally sound in some basic aspects of computer engineering.
  • 3.  Always prepare one or two subjects completely that you are interested in and want to work on.  But those subjects must be conceptually clear to you, because interviewer will pose difficult questions related to those subjects.  Always be prepared to face the questions regarding project work you’ve done throughout the engineering. ( A good point to score)  Sometimes it is good to have some information about latest technologies and innovations.
  • 4.  C Programming language.  C++ and Object Oriented Concepts  Basics of Data Structure and Algorithms  Basics of Analysis of Algorithms  Database Management System  Operating System  Basics of Networks  One or more programming Language (.NET/Java/PHP/HTML/Python/Perl/..)
  • 5.  C is a general-purpose programming language initially developed by Dennis Ritchie between 1969 and 1973 at Bell Labs.  C is an imperative (procedural) language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support.  C was therefore useful for many applications that had formerly been coded in assembly language, such as in system programming.
  • 6.  A C program, whatever its size, consists of functions and variables. A function contains statements that specify the computing operations to be done, and variables store values used during the computation.  The basic C source character set includes the following characters:  Letters: a–z, A–Z, _  Digits: 0–9  Punctuation: ~ ! @ # % ^ & * ( ) - + = : ; " ' < > , . ? | / { } [ ]  Whitespace characters: space, horizontal tab, vertical tab, form feed, newline
  • 7.  Block scope : variables are accessible within the block in which they are declared.  Function scope: variables are accessible within the function they are declared.  File scope: A variable with file scope can be accessed by any function or block within a single file. To declare a file scoped variable, simply declare a variable outside of a block (same as a global variable) but use the static keyword.  Program scope: Variables with program scope are also called global variables, which are visible among different files. These files are the entire source files that make up an executable program. static int nValue; // file scoped variable Float fValue; // global variable int main() { double dValue; // local variable }
  • 8.  The auto specifier: The auto specifier indicates that the memory location of a variable is temporary. In other words, a variable's reserved space in the memory can be erased or relocated when the variable is out of its scope.  The static specifier: When a variable within a function is declared with the static specifier, the variable has a permanent duration. In other words, the memory storage allocated for the variable is not destroyed when the scope of the variable is exited, the value of the variable is maintained outside the scope, and if execution ever returns to the scope of the variable, the last value stored in the variable is still there.  The register specifier: Each computer has a certain number of registers to hold data and perform arithmetic or logical calculations. Because registers are located within the CPU (central processing unit) chip, it's much quicker to access a register than a memory location. Therefore, storing variables in registers may help to speed up your program.
  • 9.  The extern specifier: How can a global variable declared in file A, for instance, be seen in file B? In other words, how does the compiler know that the variable used in file B is actually the same variable declared in file A?  The answer is: Use the extern specifier provided by the C language to allude to a global variable defined elsewhere.  The const modifier: If you declare a variable with the const modifier, the content of the variable cannot be changed after it is initialized.  The volatile modifier: If you want to let the compiler know that the value of a variable can be changed without an explicit assignment statement, declare the variable with the volatile modifier so that the compiler will turn off optimizations on expressions involving the variable.
  • 10.  In C, pass by value is the mechanism used to pass parameters into a function. A copy is made of the variable and that copy is used.  Because a copy is used, the function cannot alter variables that are passed in. Parameters only pass values in, not out. This is called Pass by Value.  One way to allow functions to modify the value of argument is by using pass by reference. In pass by reference, we declare the function parameters as references rather than normal variables: void AddOne(int &y) // y is a reference variable { y = y + 1; }  The above pass by reference concept is valid in C++. So how to pass by reference in C?
  • 11.  Pointers "point" to locations in memory. Pointers are just variables that store memory addresses, usually the addresses of other variables.  In order to have a pointer actually point to another variable it is necessary to have the memory address of that variable also. To get the memory address of a variable (its location in memory), put the & sign in front of the variable name.  *p performs the "dereferencing" operation on p; it looks at the address stored in p, and goes to that address and returns the value.
  • 12.  Pointers allow you to implement sharing without copying i.e. pass by reference v/s pass by copying. This allows a tremendous advantage when you are passing around big arrays as arguments to functions.  Pointers allow us to use dynamic memory allocation.  Pointers obviously give us the ability to implement complex data structures like linked lists, trees, etc.  Pointers allow ease of programming, especially when dealing with strings. This is due to the fact that a pointer increment will move by the size of the pointee i.e. easy coding to increment to the next memory location of an array, without worrying about how many bytes to move for each data type. I.e. a pointer to a char will move the pointer by a byte, pointer to an int, by the size of the int, etc. NOTE that this is important because you do not have to worry about the size of the data types which can vary on different architectures.  Pointers allow us to resize the data structure whenever needed. For example, if you have an array of size 10, it cannot be resized. But, an array created out of malloc and assigned to a pointer can be resized easily by creating a new memory area through malloc and copying the old contents over. This ability is very important in implementing sparse data structures also.
  • 13.  malloc, calloc, or realloc are the three functions used to manipulate memory. These commonly used functions are available through the stdlib library so you must include this library in order to use them.  When a program executes, the operating system gives it a stack and a heap to work with. The stack is where global variables, static variables, and functions and their locally defined variables reside. The heap is a free section for the program to use for allocating memory at runtime.  Allocating a Block of Memory : Use the malloc function to allocate a block of memory for a variable. If there is not enough memory available, malloc will return NULL.  The prototype for malloc is:  void *malloc(size_t size);
  • 14.  Allocating Multiple Blocks of Memory  You can also ask for multiple blocks of memory with the calloc function:  void *calloc(size_t num, size_t size);  Releasing the Used Space  All calls to the memory allocating functions discussed here, need to have the memory explicitly freed when no longer in use to prevent memory leaks. Just remember that for every call to an *alloc function you must have a corresponding call to free.  free(ptr);  To Alter the Size of Allocated Memory: We can use realloc function to alter the size of allocated memory.  void *realloc(void *ptr, size_t size);  Pass this function the pointer to the memory you want to resize and the new size you want to resize the allocated memory for the variable you want to resize.
  • 15.  Structures in C are used to encapsulate, or group together different data into one object. When you define a structure or union, you are creating a custom data type. struct object { char id[20]; int xpos; int ypos; };  Unions and Structures are identical in all ways, except for one very important aspect. Only one element in the union may have a value set at any given time. Everything we have shown you for structures will work for unions, except for setting more than one of its members at a time.  Unions are mainly used to conserve memory. While each member within a structure is assigned its own unique storage area, the members that compose a union share the common storage area within the memory.  Unions are useful for application involving multiple members where values are not assigned to all the members at any one time.
  • 16.  Rich operator set of C. (most importantly bitwise operators, logical operators)  Basic instruction set of C (including loops, break, continue, goto, switch, etc.)  Bit of File I/O. (some knowledge of fopen, fclose, fwrite, fread, etc.)  Some knowledge about type casting in C.  Bit of command line arguments.
  • 17.  C follows the procedural programming paradigm while C++ is a multi-paradigm language(procedural as well as object oriented)  In case of C, the data is not secured while the data is secured(hidden) in C++  C is a low-level language while C++ is a middle- level language  C++ supports function overloading while C does not  We can use functions inside structures in C++ but not in C.  C++ allows the use of reference variables while C does not
  • 18. CLASS  A class is an expanded concept of a data structure: instead of holding only data, it can hold both data and functions.  An object is an instantiation of a class. In terms of variables, a class would be the type, and an object would be the variable.  An access specifier is one of the following three keywords: private, public or protected. These specifiers modify the access rights that the members following them acquire:  private members of a class are accessible only from within other members of the same class or from their friends.  protected members are accessible from members of their same class and from their friends, but also from members of their derived classes.  public members are accessible from anywhere where the object is visible.
  • 19.  Objects generally need to initialize variables or assign dynamic memory during their process of creation to become operative and to avoid returning unexpected values during their execution.  class can include a special function called constructor, which is automatically called whenever a new object of this class is created. This constructor function must have the same name as the class, and cannot have any return type; not even void.  Constructors cannot be called explicitly as if they were regular member functions. They are only executed when a new object of that class is created.  The destructor fulfils the opposite functionality. It is automatically called when an object is destroyed, either because its scope of existence has finished (for example, if it was defined as a local object within a function and the function ends) or because it is an object dynamically assigned and it is released using the operator delete.  The destructor must have the same name as the class, but preceded with a tilde sign (~) and it must also return no value.
  • 20.  Encapsulation is the process of combining data and functions into a single unit called class. Using the method of encapsulation, the programmer cannot directly access the data.  Data is only accessible through the functions existing inside the class.  The key strength behind Data Encapsulation in C++ is that the keywords or the access specifiers can be placed in the class declaration as public, protected or private.  Advantages of encapsulation  Makes Maintenance of Application Easier  Improves the Understandability of the Application  Enhanced Security
  • 21.  C++ allows you to specify more than one definition for a function name or an operator in the same scope, which is called function overloading and operator overloading respectively.  An overloaded declaration is a declaration that had been declared with the same name as a previously declared declaration in the same scope, except that both declarations have different arguments.  When you call an overloaded function or operator, the compiler determines the most appropriate definition to use by comparing the argument types you used to call the function or operator with the parameter types specified in the definitions.  The process of selecting the most appropriate overloaded function or operator is called overload resolution.
  • 22.  #include <iostream> using namespace std; class printData { public: void print(int i) { cout << "Printing int: " << i << endl; } void print(double f) { cout << "Printing float: " << f << endl; } void print(char* c) { cout << "Printing character: " << c << endl; } }; int main(void) { printData pd; // Call print to print integer pd.print(5); // Call print to print float pd.print(500.263); // Call print to print character pd.print("Hello C++"); return 0; }
  • 23.  #include <iostream> using namespace std; class Box { double length; // Length of a box double breadth; // Breadth of a box double height; // Height of a box public: double getVolume(void) { return length * breadth * height; } void setLength( double len ) { length = len; } void setBreadth( double bre ) { breadth = bre; } void setHeight( double hei ) { height = hei; }
  • 24.  // Overload + operator to add two Box objects. Box operator+(const Box& b) { Box box; box.length = this->length + b.length; box.breadth = this->breadth + b.breadth; box.height = this->height + b.height; return box; } }; // Add two object as follows: Box3 = Box1 + Box2;
  • 25.  The word polymorphism means having many forms. Typically, polymorphism occurs when there is a hierarchy of classes and they are related by inheritance.  C++ polymorphism means that a call to a member function will cause a different function to be executed depending on the type of object that invokes the function.
  • 26.  A member of a class that can be redefined in its derived classes is known as a virtual member. In order to declare a member of a class as virtual, we must precede its declaration with the keyword virtual.  Therefore, what the virtual keyword does is to allow a member of a derived class with the same name as one in the base class to be appropriately called from a pointer, and more precisely when the type of the pointer is a pointer to the base class but is pointing to an object of the derived class, as in the above example.  A class that declares or inherits a virtual function is called a polymorphic class.
  • 27.  // virtual members #include <iostream> using namespace std; class CPolygon { protected: int width, height; public: void set_values (int a, int b) { width=a; height=b; } virtual int area () { return (0); } }; class CRectangle: public CPolygon { public: int area () { return (width * height); } }; class CTriangle: public CPolygon { public: int area () { return (width * height / 2); } };
  • 28. int main () { CRectangle rect; CTriangle trgl; CPolygon poly; CPolygon * ppoly1 = &rect; CPolygon * ppoly2 = &trgl; CPolygon * ppoly3 = &poly; ppoly1->set_values (4,5); ppoly2->set_values (4,5); ppoly3->set_values (4,5); cout << ppoly1->area() << endl; cout << ppoly2->area() << endl; cout << ppoly3->area() << endl; return 0; } The use of virtual functions is Dynamic Binding.
  • 29.  Classes that contain at least one pure virtual function are abstract base classes.  To make a pure virtual function, append =0 (equal to zero) to the function declaration.  virtual int area () =0;  The main difference between an abstract base class and a regular polymorphic class is that because in abstract base classes at least one of its members lacks implementation we cannot create instances (objects) of it.  However, pointers to this abstract base class can be used to point to objects of derived classes.  Abstract Base Class in C++ concept is similar to concept of interfaces in Java.
  • 30.  Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast implementation time.  When creating a class, instead of writing completely new data members and member functions, the programmer can designate that the new class should inherit the members of an existing class. This existing class is called the base class, and the new class is referred to as the derived class.  Syntax to inherit a class:  class derived-class: access-specifier base-class
  • 31.  We can summarize the different access types according to who can access them in the following way:  A derived class inherits all base class methods with the following exceptions:  Constructors, destructors and copy constructors of the base class.  Overloaded operators of the base class.  The friend functions of the base class. Access public protected private Same class yes yes yes Derived classes yes yes no Outside classes yes no no
  • 32.  A friend function for a class is used in object-oriented programming to allow access to public, private, or protected data in the class from the outside. Normally, a function that is not a member of a class cannot access such information; neither can an external class.  A friend function is declared by the class that is granting access.  When a function needs to access private data in objects from two different classes. This may be accomplished in two similar ways  a function of global or namespace scope may be declared as friend of both classes  a member function of one class may be declared as friend of another one.
  • 33. C++ Java Write once, compile anywhere (WOCA). Write once, run anywhere / everywhere (WORA / WORE). Allows procedural programming, functional programming, object- oriented programming. Strongly encourages an object- oriented programming paradigm. Explicit memory management. Automatic garbage collection (can be triggered manually). Pointers, references, and pass-by- value are supported. Primitive and reference data types always passed by value. Full Multiple inheritance. From classes, only single inheritance is allowed. From Interfaces, Multiple inheritance is also allowed. Exposes low-level system facilities. Runs in a virtual machine. Does not always provide full access to the features and performance of the platform on which the software runs.
  • 34.  Platform Independent  Simple  Object Oriented  Robust  Portable  Secure  Performance  Multithreaded  Interpreted
  • 35.  One characteristic of Java is portability, which means that computer programs written in the Java language must run similarly on any hardware/operating-system platform.  This is achieved by compiling the Java language code to an intermediate representation called Java bytecode, instead of directly to platform-specific machine code.  Java bytecode instructions are analogous to machine code, but are intended to be interpreted by a virtual machine (VM) written specifically for the host hardware.  The overhead of interpretation means that interpreted programs almost always run more slowly than programs compiled to native executables would. Just-in-Time (JIT) compilers were introduced from an early stage that compile bytecodes to machine code during runtime.
  • 36.  Java has the strong memory allocation and automatic garbage collection mechanism.  It provides powerful exception handling and type checking mechanism as compare to other programming languages.  Compiler checks the program whether there any error and interpreter checks any run time error and makes the system secure from crash.  Java does not use memory pointers explicitly. All the programs in java are run under an area known as the sand box.
  • 37.  The JVM's heap stores all objects created by an executing Java program. Objects are created by Java's "new" operator, and memory for new objects is allocated on the heap at run time.  Garbage collection is the process of automatically freeing objects that are no longer referenced by the program.  In the process of freeing unreferenced objects, the garbage collector must run any finalizers of objects being freed.  In Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected.
  • 38.  Multithreading is a technique that allows a program or a process to execute many tasks concurrently (at the same time and parallel). It allows a process to run its tasks in parallel mode on a single processor system.  Advantages of multithreading over multitasking:  Reduces the computation time.  Improves performance of an application.  Threads share the same address space so it saves the memory.  Context switching between threads is usually less expensive than between processes.  Cost of communication between threads is relatively low.
  • 39.  The Java collections framework (JCF) is a set of classes and interfaces that implement commonly reusable collection data structures.  There are three main types of collections:  Lists: always ordered, may contain duplicates and can be handled the same way as usual arrays  Sets: cannot contain duplicates and provide random access to their elements  Maps: connect unique keys with values, provide random access to its keys and may host duplicate values
  • 40.  An exception is a problem that arises during the execution of a program. An exception can occur for many different reasons, including the following:  A user has entered invalid data.  A file that needs to be opened cannot be found.  A network connection has been lost in the middle of communications, or the JVM has run out of memory.  Checked exceptions: A checked exception is an exception that is typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. These exceptions cannot simply be ignored at the time of compilation.  Runtime exceptions: A runtime exception is an exception that occurs that probably could have been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time of compilation.  Errors: These are not exceptions at all, but problems that arise beyond the control of the user or the programmer. Errors are typically ignored in your code because you can rarely do anything about an error. For example, if a stack overflow occurs, an error will arise. They are also ignored at the time of compilation.
  • 41.  Java I/O  Networking in Java  Event Handling in Java  Applets and AWT framework  Little knowledge about SWING framework  Generics in Java
  • 42.  Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.  Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks.  Some Examples:  Arrays  Structures  Stacks  Queues  Heaps  Linked Lists  Graphs  Trees  Hash Tables  Tries
  • 43.  An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs.
  • 44.  Kernel Architectures.  Memory management.  Thread vs. Process.  Concurrency Control Mechanism.  Cache Memory.
  • 45.  Four broad categories of kernels:  Monolithic kernels provide rich and powerful abstractions of the underlying hardware.  Microkernels provide a small set of simple hardware abstractions and use applications called servers to provide more functionality.  Exokernels provide minimal abstractions, allowing low- level hardware access. In exokernel systems, library operating systems provide the abstractions typically present in monolithic kernels.  Hybrid (modified microkernels) are much like pure microkernels, except that they include some additional code in kernel space to increase performance.
  • 46.  The memory management function keeps track of the status of each memory location, either allocated or free.  It determines how memory is allocated among competing processes, deciding who gets memory, when they receive it, and how much they are allowed.  When memory is allocated it determines which memory locations will be assigned. It tracks when memory is freed or unallocated and updates the status.
  • 47.  Single contiguous allocation: All the computer's memory, usually with the exception of a small portion reserved for the operating system, is available to the single application.  Partitioned allocation: Partitioned allocation divides primary memory into multiple memory partitions, usually contiguous areas of memory. Each partition might contain all the information for a specific job or task. Memory management consists of allocating a partition to a job when it starts and unallocating it when the job ends.  Paged memory management: Paged allocation divides the computer's primary memory into fixed-size units called page frames, and the program's address space into pages of the same size. The hardware memory management unit maps pages to frames.  Segmented memory management: Segments are areas of memory that usually correspond to a logical grouping of information such as a code procedure or a data array.  Virtual Memory
  • 48. Threads Process thread of execution is the smallest unit of processing that can be scheduled by an operating system. a process is an instance of a computer program that is being executed. Process can have multiple threads. Sharing data among threads is trivial because threads share the same memory. (However, great care must be taken to avoid race conditions, as described previously.) Sharing data among processes requires the use of IPC mechanisms. Advantage of a multithreaded program allows it to operate faster on computer systems that have multiple CPUs, CPU s with multiple cores, or across a cluster of machines — because the threads of the program naturally lend themselves to truly concurrent execution.
  • 49.  Concurrency control ensures that correct results for concurrent operations are generated, while getting those results as quickly as possible.  Techniques of concurrency control in Database Systems:  Two Phase Locking Protocol  Precedence Graph  Timestamp Ordering  Techniques of concurrency control in Operating Systems:  Semaphores  Monitors
  • 50.  Primary storage: Main memory is directly or indirectly connected to the central processing unit via a memory bus.  Secondary storage: The computer usually uses its input/output channels to access secondary storage and transfers the desired data using intermediate area in primary storage.  Cache Memory: The cache is a smaller, faster memory which stores copies of the data from the most frequently used main memory locations.
  • 51.  First Step: Create a program in editor.  #include<stdio.h> void main() { printf(―Hello World‖); }  Second Step: Compile the Program (gcc hello.c)  When we call compiler, before compiling preprocessing takes place.  So all the preprocessor directives are expanded.
  • 52.  After Preprocessing source code is compiled.  Compilation Process:  The front end checks whether the program is correctly written in terms of the programming language syntax and semantics.  The middle end is where optimization takes place. Typical transformations for optimization are removal of useless or unreachable code.  The back end is responsible for translating the IR from the middle-end into assembly code.
  • 53.  Still, the external references to library code is remaining.  Here comes Linking:  When a program comprises multiple object files, the linker combines these files into a unified executable program, resolving the symbols as it goes along.  One or more system libraries are usually linked in by default.  After linking pass, we get an executable which is ready to be executed.
  • 54.  Now, to execute that executable it is to be loaded into main memory.  So next comes Loader  Loading a program involves reading the contents of executable file, the file containing the program text, into memory, and then carrying out other required preparatory tasks to prepare the executable for running.  Once loading is complete, the operating system starts the program by passing control to the loaded program code.
  • 55.  BEST OF LUCK  Thank You