Interview Questions C and Java

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 39

JAVA QUESTIONS

Explain different way of using thread?


Thread can be implemented by using thread class or by
runnable interface. Using runnable interface is more
advantageous because it can be used in multiple inheritances.

2. Difference between HashMap and HashTable?


HashMap is similar to HashTable, the only difference is that
they are unsynchronized and they permit NULL. HashMap
doesn’t guarantee that the map order will be maintained.

3. What is the difference between a constructor and a


method?
A constructor is member function and it is used to create
object of the class. It assigns the same name as that in the
class, and has no return type. Whereas method is a ordinary
member function, which has own name and return type. They
are invoked using dot operator.

4. What is the disadvantage of threads?


The major disadvantage is that
It is operating system dependent.
Execution of thread reduces speed
High possibility of Dead Lock.

5. What is garbage collection? Can it be forced?


Garbage collection is mainly to identify and discard
objects which is no longer used. It is required by the program
for alloction of resources and reclaiming them. Java virtual
machine tries to recycle the unused object, but there is no
guarantee that the object is garbage collected.

6. What is Log4j in java?


Log4j is a property file wich can be used to assign
application mode in “DEBUG”, “ERROR” etc.

7.What are the primitive types in Java?


Java support eight types of primitive data types and they
are as follows:-
Short
Int
Byte
Float
Char
long
Boolean

8. How all can free memory?


If a programmer really wants to explicitly request a garbage
collection at some point, System.gc() or Runtime.gc() can be
invoked, which will fire off a garbage collection at that time

9. What are the differences between JIT and Hotspot


JIT is a compiler whereas Hotspot is a collection of techniques,
also called as optimization.
Java hotspot is a core component of the Java platform. It
implements JVM specification and uses shared library.

10. What is the difference between concat and append?


Concat is used to add a string at the end of another
string.But append() is used with String Buffer to append
character sequence or string.When we concatinate a string
with another string a new string object is created.But in case of
StrinBuffer APPEND() that is not the case.

11. What is EJB?


EJB stands for Enterprise Java Bean. It is a server side
resident resource manageable, secure, reusable component.

12. What is package? Define with example?


Grouping of related types is said to be package. The
type can be a class or enumeration or interface and annotation.
They are provided with access protection. It is a group of inter-
related classes

13. What is the difference between length and length()?


Length() is a method that is used to determine the length
of the string in the class, Whereas length is just used for array
to find the length of the array.

14. What is synchronization and why it is important?


Synchronization occurs when the programmer want to run
two thread at a time which shares some property.
Synchronization is the process that control access to multiple
threads to share resources.

15. How to make a class serializable?


Class can be serialized by using the interface or the
io.externalizable or io.serializable. When one class is
inheritance to the other, the class is said to be serializable.

16. Do I need to import java.lang package any time? Why ?


No. It is by default loaded internally by the JVM.

17. What are the different types of inner classes?


The different type of inner classes are as follows:-
Local classes
Anonymous classes
Nested top- level classes
Member classes

18. What is a member class?


It is one of inner class which is just like the other methods
and variables and they are restricted to access. The major
difference between member and nested top level class is that it
can access specific instance of the corresponding class.

19. What is the difference between error and exception?


An error that occurs during runtime is not recoverable
whereas in most of the cases an exception can be recovered if
it occurs during run time.

20. What are the different ways to handle exceptions?


The two methods to handle exception are as follows:-
Wrapping the desired code in the try block that is followed
by catch block
List out the desired exception in throw and the caller of the
method handle
the exception

21. If I write System.exit (0); at the end of the try block, will
the finally block still execute?
When you type System.exit(0) in the end it indicates the
compiler to stop compiling and execute of the program, thus
the finally block will not be executed.

22. How are observer and observable used?


Objects that subclass the Observable class maintain a list
of observers. When an Observable object is updated it invokes
the update() method of each of its observers to notify the
observers that it has changed state. The Observer interface is
implemented by objects that observe Observable objects.

23. How does Java handle integer overflows and


underflows?
Java handles integer overflow and underflows using
low order bytes that fit in the size of the type that is allowed by
the operation.

24. What is locale class?


The class is mainly used to tailor the output of the
program with respect to the specification

25. Can applets communicate with each other?


An applet may communicate with other applets
that are running in the same virtual machine. When the applet
are from same class it can communicate using static variable,
when the applet are of different class it can communicate
through reference.

How does a try statement determine which catch clause


should be used to handle an exception?
When an exception is thrown within the body of a try
statement, the catch clauses of the try statement are examined
in the order in which they appear. The first catch clause that is
capable of handling the exception is executed. The remaining
catch clauses are ignored.

2. Is Empty .java file a valid source file?


An empty java file is perfectly a valid java source file.

3. Is delete a keyword in Java?


Delete is not a keyword in Java. Java does not make use of
explicit destructors the way C++ does.

4. How many objects are created in the following piece of


code?
MyClass c1, c2, c3;
c1 = new MyClass ();
c3 = new MyClass ();
c1 and c3 are the two objects created. The c2 is only
declared and not initialized.

5. What will be the output of the following statement?


System.out.println ("1" + 5);
Output:-
15.

6. What will be the default values of all the elements of an


array defined as an instance variable?
If the array is of primitive data type then the elements of the
array is initialized to default value. If the array is of reference
type then it is initialized to NULL.

7. What are the different scopes for java variables?


The different scopes for java variables are as follows:-
Local
Instance
Static

8. What is the default value of the local variables?


When the local variables are not initialized explicitly the java
compiler will not compile. And it will not initialize any default
value for these local variable.

9. Can main method be declared final?


The main method can be declared final with the addition of
public static.

10. Does Java provide any constructor to find out the size
of an object?
There is no sizeof operator in java. It is not possible to
determine the size of the object directly in java.

11. What is the Map interface?


Map is an object which helps to map the keys to values. It is
not possible to have duplicate keys. It is essential that each
key should map to a one value.
Three Map implementations are
Hashmap
LinkedHashmap
Treemap

12. What is collection Views?


Collection view is a metho that is used to view map as a
collection. This can be done in three ways:-
Values
Keyset
Entryset

13. What is multimaps?


Multimap is also like map which map key to multiple values.
But there is no separate interface for multimap in Java since it
is used quiet often. It’s much more simple to use map whose
values to list instance as a multimap.

14. What is the SimpleTimeZone class?


It is a subclass of Time zone which represent time zone that
could be used with Gregorian calendar. It doesn’t handle any
changes.
public class SimpleTimeZone
extends TimeZone

15. Is &&= a valid Java operator?


no &= is a valid operator not &&=

16. Is "abc" a primitive value?


Abc is a string object it is not primitive value.

17. What modifiers can be used with a local inner class?


Some of the modifiers that can be used in the local inner
class are as follows:-
Final
Abstract
Static modifier

18. Can an unreachable object become reachable again?


An unreachable object becomes reachable if the objects
finalize() method is invoked, the object performs operation that
causes the object to accessible.

19. What happens when you add a double value to a


String?
When double value is added to the string it becomes a string
object.

20. What is Layout Managers?


It is an object that implements LayoutManager interface and
also determines the position and size of the components within
a container.
Some of the task associated with layout manager are as
follows:-
Adding space between components
Adding components to container
Setting up layout manager

21. What is a compilation unit?


A compilation unit is composed of two parts: an interface
and an implementation. The interface contains a sequence of
specifications, just as the inside of a sig … end signature
expression. The implementation contains a sequence of
definitions, just as the inside of a struct … end module
expression

22. Which package is always imported by default?


“Java.lang” is the package that imported by default.

23. What is numeric promotion?


Numeric promotion is a conversion of numeric type of
smaller to a larger numeric type,so that integer and floating-
point operations may take place. In numerical promotion, byte,
char, and short values are converted to int values. The int
values are also converted to long values, if necessary. The
long and float values are converted to double values, as
required.

24. Which arithmetic operations can result in the throwing


of an ArithmeticException?
Integer / and % can result in the throwing of an
ArithmeticException.

25. What is the ResourceBundle class?


It contains locale specific objects. If a program requires
locale specific resources then the program can load resource
bundle that is appropriate for the current user.
Advantage:-
Make it localized, and can be translated into different
languages.
Modification can be done easily.
C QUESTIONS

1.What is a NULL macro?


A NULL macro is just what is defined as 0 in macro which
is provided by the library.

2. What is the difference between a NULL pointer and a


NULL macro?
A NULL pointer is a pointer that points to nothing. It can be
some other address in another system or 0 in case of
UNIX/Linux system. Using the NULL macro to set/initialize your
pointers will make your programs more portable among
systems than using something like the 0.

3.What do the ‘c’ and ‘v’ in argc and argv stand for?
c in argc stands for count
v in argv stands for vector

4. Which Bit wise operator is used to determine whether a


particular bit is on or off?
The Bit wise OR | operator can be used to check
whether particular bit is on or off.

5. Can you dynamically allocate arrays in expanded


memory?
realloc() is used to expand or to shrink the memory.

6. How do you declare, An array of three char pointers?


1.char *p[3];
2.char (*p)[3];

7. How would you use the functions sin(), pow(), sqrt()?


is the header file
sin(a) will returns the sine of a,
pow(a,b) will returns a the value a to the power b(a^b)
eg:pow(3,2) will returns 9;
sqrt(b) returns the square root of b
eg: sqrt(4) returns 2;

8. In header files whether functions are declared or defined?


The functions are declared in header files. Rather, functions are
defined in the library routines only.

9. Difference between strdup and strcpy?


strcpy:- string copy function copies the string to the specified
location
strdup:- this function allocates space and make sure that your
string fit into the location and then copy the string.

10. Difference between Pass by Value and Pass by reference?


In pass by reference:- the address of the variable is passed to
the function. Whatever changes made will affect the actual parameter
Pass by value:- This function pass the variable, all the changes made
will not affect the actual value.

11. What are the different storage classes in C?


The storage classes in C are as follows:-
Auto
Static
12. Difference between arrays and linked list?
Array allocates sequentially while link list uses linked allocation
Array are more suitable for static data type whereas link list used
for dynamic data types.
Array cannot be expanded.
Array memory allocated staticaly whereas link memory
allocated dynamically.

13. What is a far pointer? Where we use it?


A far pointer is a four byte pointer that used to access the main
memory of the system. It can access the code and data segment, just
by modifying the offset you can modify the address.

14. Difference between far and huge pointer?


The major difference between the two pointers are as follows:-
Far pointer are not normalized whereas huge pointer are
normalized

15. State some examples of recursive functions?


Examples of recursive functions are as follows:-
Factorial of a given number
Palindrome
Fibonnaci series
GCD

16. Explain one method to process an entire string as one unit??


The following method can be used to process an entire string as
one unit
get() function
pointer
Treating the entire string as char array

17. Can you use the function fprintf() to display the output on the
screen?
fprintf() is used to write data into the file. hence it cannot
be used to display the data in the screen.

18. What is a linklist and why do we use it when we have arrays?


linklist are best suited when we actually don't how much
memory required for the data, and it is more preferable for dynamic
data.

19. What is the difference between main() in C and main() in C+


+?
Their is no much difference between the main in C and C++
by default c main() returns void but in c++ it returns integer value
C++ main is superset of C main()

20. Where are the auto variables stored?


Auto variables are stored in memory and they contain
garbage value as default value.

What will be output of the following program:

void main()
{
int const * a=5;
printf("%d",++(*a));
}
The following will have compile time error. Since, a variable declared
constant has been modified.
2.What if the function of clrscr()?
clrscr() is a function that creates a new screen or creates a screen full
of dots which is nothing but clearing the screen.

3. Which mistakes are called as token error?


Syntax or Parse errors before a Token are called as token error.

4.What are tokens in c?


The C compiler recognize some of the basic elements in C, they are
called as tokens.
Examples:-
Operator, identifier, punctuator and constant
Even punctuation characters are also tokens

5.What is White-space Characters?


newline, tab, space, carriage return and formfeed characters are called as
White-space Characters since they serve the same purpose as the space
between words. The white- space is to increase the readability of the
program.

6.What are string literals?


A sequence of character which when taken together form null
terminated string is called as string literals. Wide string literals must be
prefixed with L.

7. What are constants?


A number, character string, or character which is used as a program
value is called constants. A constant is characterized by the type and the
value.
integer-constant
floating-point-constant
character-constant
enumeration-constant

8. Why two pointers cannot be added in c language?


Adding two pointers is meaningless, as it similar to adding two
unknown addresses. Hence two pointers cannot be added.

9. What is the function of % using in formatted string?


The next character is a conversional character and these two
characters are replaced by the value of the variable in the argument list
when displayed.

10. What is the use of semicolon at the end of every statement?


Semicolon instructs the complier that it has reached the end of the
statement. In other words it act as a terminator, else these statements will
be endless.

11. Can you write a function similar to printf()?


Function that similar to printf(), C uses inbuilt datatypes such as
va_start(), va_list(), va_end().

12. Verify the following Code

#include
int main ()
{
int a [5];
a [3] = 1111;
printf ("3[a] = %dn", 3[a]);
return 0;
}

The above code will work since when the program is executed. the
compiler coverts it into pointer function *(a + 3) for a[3]. Same conversion
only it does for 3[a]. This can work out in printf but not in scanf.

13. How would you detect a loop in a linked list? Write a C program to
detect a loop in a linked list.
Two methods available to detect a loop in a linked list.
• One way of detecting is through is to flag the link visited
• Have 2 pointers to start of the linked list. Increment one pointer by 1
node and the other by 2 nodes. If there's a loop, the 2nd pointer will meet
the 1st pointer somewhere. If it does, then you know there's one.

14. What are the rules for constructing real constants?


Real constant or otherwise called as floating point constants. It consist
of two parts exponential and fractional part.
Rule are as follows:-
• Should contain at least one digit.
• It takes the positive sign as default sign. if no sign specified
• No blanks or comma allowed in between.

15. How do you write data to low level disk I/O?


The only way data can be written inoder to read in low level disk I/O
functions as buffer full of bytes. Writing a buffer full of data is similar to
fwrite() function.

16. State some significant uses of arrays in C programming?


The most important usage of array in C programming is that the ability
to store strings of text. The element of array can store single character, the
final array element contain a special null character

17. Why do we use structures?


Structures are used for different purposes they are
• Inorder to construct individual array
• To use a structure variable

18. State the difference between sprint () and printf() Functions?


The work of sprint is similar to printf() statement, the only difference
is that instead of writing the output in the output screen, the function write
the output to an array of character.

19) What are the different styles present in


WS_OVERLAPPEDWINDOW?
The different forms are as follows
• WS_MINIMIZEBOX
• WS_OVERLAPPED
• WS_THICKFRAME
• WS_CAPTION
• WS_MAXIMIZEBOX.
All these macros are included in the ‘windows.h’ header file.

20) Explain about register variables relative to compiler?


A variable declared with register instructs the compiler that the specified
variable will be used by the program heavily. The main aim is to place the
variable in the machine register inorder to increase the speed access
times. Local internal variables can only be declared as register variables.

CALL CENTER QUESTIONS

Do you know how to speak English with American accent?


Most of the company looks for candidates who are able to
take up new challenges in the job. Everything expected in a
job, may not be present in all the candidates. Skills required for
the job may not be present in the candidate, and even the
recruiter doesn’t expect that the job applicant should have all
the skill. Rather the job aspirant should have a willingness to
learn skills that the individual doesn’t possess.
It is not possible for all the applicants to talk in American
accent, if the applicant doesn’t possess the skill he/she should
have the willingness to learn.

2) What are your biggest weaknesses?


No person is without any weakness. If a job applicant says
that he/she doesn’t have any weakness, that doesn’t mean the
interviewer that the candidate is 100% perfect. Each and every
person have some kind of weakness, while specify in the
interview care should be taken that these weakness should not
affect the job.
While specifying the weakness the job seeker should also
provide the steps that he/she taking, inorder to overcome the
weakness. The job seeker should be able to convert the
weakness also positive at to be able to make use of the skill in
the job environment.

3) Tell something about BPO?


Before choosing the field work, job seeker should have
some knowledge about the field, this will help to analyze about
themelf, whether they choose the right filed that fits their skill
sets and knowledge that will help them to make use of the
skills effectively.
To answer the above question, it is essential for job seeker
to know about the BPO industry inorder to speak about the
industry in the interview.
BPO is nothing but business process outsourcing, which in
general means outsourcing the business process. It is a
process of hiring company to handle the business process.
This question is basically to check the awareness about
BPO in the job seeker and also the willingness to work in the
industry.

4) What would u do, if you become a prime minister of


your country for six months?
Such questions are asked in the interview to know how well
the job seeker is able to plan and organize themselves. This
also shows the readiness of the job seeker to take
responsibility and well ho/she could perform effectively in an
organization.
Always have a positive approach while answering such
question. Answer with a realistic approach. Convey things
which can be achieved.

5) What is the difference of domestic and international call


centre?
Domestic call centre is the work done for within the country.
International call centre is work done for countries outside. The
major differences exist in work environment.
Answer to the above question will give a clear picture to the
HR that you very well know about the industry. It will make the
task of the recruiter easier in finding the right job that matches
the job seeker.
Traditional cal centre or domestic call centre involves
outsourcing, who Place their call centers around native
country. International call centre operate with network of
operation in offshore in different countries.
The different outbound and inbound services consist of
* Reservations
* Telemarketing
* Customer support
* E-commerce
* Web forms
* Chat
* Cross selling
* IVR
* Surveys
* Sales/retention programs
* E-mail handling

6) If You join the company then what is the first thing you
want to do , which you were not able to do in ur previous
company?
This is to ensure the commitment towards the job. As soon
as you join the company the main goal of the job seeker should
be able to fulfill the task and responsibility given to you. The
applicant should be able to expand the skill and task apart from
the normal task assigned to him/her.

7) Are you confident of your communicative skills in


convincing people?
As the call centre job purely requires the skill to convince
people. Thus the call centre executives require to convince the
customer inorder to retain the customer.
While answering such question show your confidence and
try to create an impression that you can best convince all kind
of people.
Never be negative while you answer such question,
eventhough you are not that good in convincing the customer
your answer should be yes I would be effective communicator
with the people.
8) Which one do you think –web or voice –suits your
qualifications better?
If you have a complete focus on either voice or web, you can
tell about your preference to the recruiter. Have valid reason
for choosing any particular field.

9) Will you be comfortable working in different shifts?


As call centre job are purely shift based the job seeker
should be able to manage in working in such kind of
environment. Applying for a call centre and not interested in
working for shift base job, will not help the job seeker to get
selected.
So the main objective of the job seeker is to show the
willingness to work in shift base environment.

10) Where do you see yourself 3 years down the line?


The major aim of the above question is to know the job
seeker goal and objective. Job seeker should be careful while
answering such question. He/She should specify realistic
position that could be attained in these three years.
The job seeker requires to be aware of the positions in the
industry and what position can be achievable within three
years. This will help to communicate the right position in three
years.

11) What If Some Other Company Offers You More Than


us?
This question tells how far you are stable in choosing a job.
Genenrally job seekers have one or three offers in hand so that
they can choose the best that fit it in their requirement.
Commonly this question asked in the interview to know
whether you have decided in choosing this company and you
will work a long for a longer period of time.
The best way to answer to this question is to say that “I best
fit into this job and company, since I feel comfortable in working
for this company. Even though some other company offer me
more package then your company, I would still opt for this
company since it provide a good work environment and better
job satisfaction’.
Always have your answer that are realistic and that reliable.
It should create a trust on the recruiter that you will join the
company.

12) The call center and its function.


A call centre is an office where the employees receive
inbound calls and the employees also make outbound calls.
Call centre are becoming popular now a days. Since most of
the companies have centralized customer services and
functions to support. The employees are responsible for sales,
service and support function.
The main goal of the call centre is to provide better service
to the customer with respect to product, in terms of sale should
be able to reach high target.
Knowing the functions in the call centre will help the job
seeker to perform better as well to be aware of the work
environment that he/she will be put up.

13) What are the Call Center and Customer Service main
objectives?
This will help the recruiter how far he/she will be able to
satisfy the customer and to manage the customer effectively.
Answer:-
The main objective of the customer service is to provide
customer satisfaction and retention which is very much
essential to sustain as well for future progress of the
organization. Call centre consist of different kinds of customer
and of different type. Inorder to create an awareness about the
customer such question are asked in the interview.

14) How would you maintain customer satisfaction?


Eventhough you are not capable of satisfying the customer,
but still the job seeker should try to show the recruiter that
he/she able to convince the customer.
You could develop your own strategy to provide better
satisfaction to the customer.
* Better assisting the customer.
* Identifying the problem and solve them in effective way.
* Keeping track with the customer after the service has been
provided
The above points help to better serve the customer.

15) The procedure you should take when speaking with a


customer?
Questions asked in the interview not only rely on the
experience but also how well you could satisfy the customer.
Speaking with the customer requires a good attitude,
maintaining a good relationship with the customer. The main
goal of the executive is to satisfy the customer and able to
resolve the problem that the customer claims.

16) Why did you want to join the call center?


Choosing a career in BPO may have many reasons, while
describing the same in the interview, care to be taken while
answering the question. since the answer decide whether to
select the job seeker or not. The best way to convince the
recruiter is by emphasizing on your personal traits that best fit
in this job. Apart from these the job seeker should have a good
knowledge about the BPO industry this will show the
involvement and professionalism.

17) Why do you left your previous job?


The job seeker should never say any fault about the
previous company. This will create a bad impression about the
applicant. The job seeker can provide valuable reason such as
‘since there is no much progress in my previous job and I am
looking for better opportunity.

18) why do you want to join a call centre being a computer


science graduate?
Careful attention job seeker requires to have since this will
give the view what the job seeker have about the call centre.
Answer:-
Call centre is an international business, where I could
confront different types of people, It helps me to develop
communication skill. salary and bonus also attracts me to join
in call centre. It’s purely a performance based job, develop a
good negotiating power, so I like it.
While answering it should show your involvement towards
working in a call centre. All other factors should be of
secondary choice.

19) What is your greatest strength?


Before answering such question the job seeker require to
prepare themself to answer, since this the most frequently
asked question in the interview. Identify the strength that can
best sell yourself in the job market.
While specifying the strength, the job seeker should be
capable in relating to the job position that has been posted. Job
seeker should be realistic while specifying the strength and
should also relate with good example.

20) Can u stay awake in the night?


Call centre job mostly works on shift basis. If a candidate is
not willing to take up shift base work then there is no point in
working in such environment.
The job seeker should always create more chance for the
recruiter to select you, this requires lot of talent on the job
seeker side. Thus the job seeker should show the willingness
to take up difficult tasks. The job seeker should have the
willingness and as well show the interest to work for night shift.
Job seeker should cultivate a habit to work in night shift. The
recruiters will be able to analyze whether the candidate right fit
into the job.

21) How would you describe your computer skills?


Proficiency in computer skills is very much essential for any
job seeker in the job environment. This helps the task of the
recruiter also easier. Computer skills play a vital role in the
selection process.
Describe your skills quantitatively that will figure out you
effectively in an interview.
For example if you are going to take up an job for data entry
you require typing speed, the recruiter will mainly look for
proficiency in typing.
JAVA QUESTIONS
1) What is JVM?
JVM enables to convert the source code into the code which can be
executed in the system. This makes the java independent of the platform

2) Name four container classes?


* Dialog
* FileDialog
* Panel
* Frame

3) What is JAR file?


JAR stands for java archive, it is used to compress a class of file.

4) What is typecasting?
Typecasting converts entity of one type to entity of another type. It is very
important while developing applications.
Casting is of two types:-
1. downcasting
2. Upcasting

5) What is serialization and deserialization?


It is process of representing the state of an object in byte stream.
Process of restoring the object is done be deserialization.

6) What is vector class?


Vector class provides the capability to implement array of objects.

7) What is JVM and its use?


The most important feature of Java is platform independent, this is
supported by JVM. It converts the machine code into bytes. It is the heart of
the java language and a structure programming language.

8) What are the difference between java and C++?


Java adopts byte code whereas C++ doesn’t.
C++ supports destructor whereas java doesn’t support.
Multiple inheritance possible in C++ but not in java.

9) Difference between swing and AWT?


AWT is works faster then swing since AWT is heavy weight
components.AWT consist of thin layer of code, swing is larger and of higher
functionality.

10) If a variable is declared as private, where may the variable be


accessed?
When the variable is declared private, it can be accessed only inside the
class in which it is defined.

11) What is final?


A final class cannot be sub classed neither extended. The variables
cannot change the value.

12) What is static in java?


Static methods are implicitly final, their methods are not attached to an
object rather it is attached to a class.

13) Is null a keyword?


NULL is not a keyword.

14) What is garbage collection?


When an object is no longer used, java implicitly recalls the memory of
the object. Since java doesn’t support destructor it makes use of garbage
collector in the place of destructor.

15) What is the resourceBundle class?


It is used to store the local specific resources inorder to tailor the
appearance.

16) What is tagged interface?


Tagged interface is similar to the serializable interface, it instruct the
complier to perform some activity.

17) What is overriding?


When any class use the same name, type and arguments as that of the
methods in the super class then the class can override the super class
method.

18) What is referent?


Referent variable are constant variable it cannot be modified to refer to
any other object then the one with it was initialized.

19) What is the method to implement thread?


Thread can be implemented by run() method

20) What is the difference between primitive scheduling and time


slicing?
In case of primitive scheduling the task with highest priority is performed
until it enters the dead state. In case of time slicing it performs the task for
sometime and then enter the ready state.

21) What are different types of access modifiers?


public: accessible from anywhere.
private: can be accessed only inside the class.
protected: accessed by classes and subclasses of the same package.
default modifier : accessed by classes contain the same package

22) What is the difference between subclass and superclass?


Subclass doesn’t inherit anything from other classes whereas superclass
inherit from other class.

23) What is a package?


Package is a collection interface and class which provides a very high
level of protection and space management.

24) What is the difference between Integer and int?-


Integer defined in java. lang package which is a class, whereas int is a
primitive data type defined in the Java language itself.

25) What is synchronization?


It is mechanism that allows only one thread to process the thread at a
time. This is mainly to prevent deadlock.

C QUESTIONS

What is static variable?


Static variable are constant variable whose value remain
the same throughout the program. Static variable are instant
variable

2) How can you determine the size of an allocated portion


of the memory?
The malloc or free implementation would determine the size
of the memory easily.

3) Why do we use structure?


Structures are used for various purpose
* Use of structure variable
* To develop individual array.

4) Define these functions fopen(), fread(), fwrite() and


fseek()?
Fopen():- function to open a file, the pointer points to the first
record in the file.
Fread():- it reads the file were the pointer is pointing.
Fseek():- This function enables to move from one record to
another.
Fwrite:- This function write data in the file were the pointer is
pointing.

5) What are logical operators in C?


Logical operators in C are AND and OR operator.
AND denoted by && for example exp1&& exp2
OR denoted by || for example exp1||exp2
6) What is enum used for and state its format?
Enum creates a sequence of integer constant. It is optional
to use the name in the enum. The names are separated by
comma and within the curly braces.

7) what is ternary operator?


This operator return the value based on the evaluation of
the expression.
General format:-
(expr 1) ? true: false
It is similar to if else construct.

8) Can u write c program without using main function?


Without the main function the program will not be executed.
The compiler starts compiling from the main function.

9) What is the use of main function?


The main function invokes other function within it. It is first
function during the execution of the program.

10) Is c a structural language?


No C is a procedural language. An example of structural
language is COBOL.

11) What are the rules for constructing the real constant?
* A real constant should have atleast one digit
* It should be a decimal point
* By default it is assigned positive value
* Within real constant no blank space or commas.

12) The following variable is available in xyz.c, who can


access it?:
Static float score
All the functions that contained in the file can access the
variable.

13) Disadvantage of using pointers?


The major disadvantage of using pointers is that hackers
easily identify source code address and can modify the source
code. It is possible to access even the restricted memory
space.

14) Why do we use void main() in C language?


The program starts its execution from void main function.
Every function in the program return some value after the
execution of the function.

15) How can I convert number into string?


Number can be converted into string by using the itoa()
function. Sprintf can also be used to convert number into
string.

16) What are the advantages of the functions?


·Testing is much easier
·More readability
·Improves the performance of the program
·Reduce the program size.
·Understanding the logic quiet easy.

17) Difference between internal and external static?


Static variable declared internally within the static class and
have scope within the class is internal static variable. External
static variable declared outside the function and have scope
throughout the program.

18) Are pointers integers?


Pointers represents the address and it is merely holds a
positive value.

19) Can a file other then abc.h be included with #include?


Whatever file specified in the # include the preprocessor
would include it. It is always advisable that the programs
should be saved with .c extension.

20) what is static identifier?


Static variable represents local variable and it remains in
the memory even after the execution of the function.
21) what is static identifier?
Static variable represents local variable and it remains in
the memory even after the execution of the function.

22) What are the advantages of the automated variable?


Auto variable can be used in different blocks.
Efficient use of memory.
Variables are protected.

23) What is the use of clrscr()?


Clscr() is a function creates a black screen that creates an
impression of clearing the screen.

24) What is the difference between far and near?


Near pointer operates under 64 kilo bytes and far pointer
operates under 16 kilo bytes. Far pointer are little slower when
compared to near pointers.

25) What is size of operator?


Size of operator is to obtain the size of the operand. Format
of size of operator Sizeof ( expr).

JAVA QUESTIONS

What is an object?
An object is an entity, which consist of attributes, behaviors and qualities
that describe the object.

2) What is a class?
A class represents a collection of attributes and behaviors of object. It is
the class from which individual objects created.
For example:-
Bicycle is a class that contain the following attributes
Speed
Gear
3) What is OOAD?
OOAD stands for Object Oriented analysis and design. It is a
methodology use to analyze, design and develop applications. It visualizes
the class and the objects.

4) What are the advantages of OOAD?


* Reusability
* Maintainability
* Increase the performance of the system.

5) What is Data Abstraction?


It is a process of listing the essential features, without implementation
details. Data abstraction is nothing but the extraction of the information
which is required and ignoring the other information.

6) What is Data Encapsulation?


Data encapsulation or data hiding is a function that keeps the
implementation details hidden to the user. The user of the application is
allowed to perform only limited task with the class members that are
hidden.

7) What is the difference between data abstraction and information


hiding?
Abstraction mainly focus on the outside view of the object whereas
encapsulation prevents the user from seeing the inside view where the
properties and behavior of the abstraction is implemented.

8) Why is java not 100% pure OOPS language?


Java doesn’t support 100% pure OOPS concept, since it support
primitive datatype like int, long, byte etc, these are not objects.

9) Qualities for a program to be 100% OOPS language?


Encapsulation/Data Hiding
1. Polymorphism
2. All predifined types are objects
3. Inheritance
4. Operations performed through messages to objects
5. Abstraction
6. datatypes are to be objects.

10) What is early binding?


Early binding or static type or static binding is assigning the value of the
variable during design phase. Early binding instruct the compiler to allocate
space and perform other task before the application starts executing.

11) What are the disadvantages of threads?


o The main disadvantage of using thread is that it is operating system
dependent. It require to follow CPU cycle that various from system to
system.
o Deadlock occurs

12) Why is java case sensitive?


Java is platform independent language. It is widely used for developing
code which contains different variables and hence java is case sensitive.

13) What is singleton class?


A class which can create a single object at a time is called class. The
object is accessible by the java virtual machine. It creates a single instance
for the class

14) Objects are passed by value or by reference?


In java objects are passed by value. Since, the object reference value is
passed both the original and the copied parameter will refer to the same
object.

15) What is serialization?


It is a method which saves the object state by converting to byte stream.

16) What is externalizable interface?


Externalizable interface controls the serialization mechanism. It consist
of two methods readexternal and writeexternal. It helps to customize the
serialization process.

17) What are the different types of inner classes?


* Member classes.
* Anonymous classes.
* Nested top-level classes.
* Local classes.

18) What are wrapper classes?


Wrapper class represents a base class for the data source. It allows the
primitive datatype to be accessed as objects.

19) What are the different ways to handle exception?


* By placing the desired code in the try block and allow the catch block
to catch the exception.
* Desired exception can be placed in throw clause.

20) Is it necessary that each try block must be followed by a catch


block?
It is not essential that try block should be followed by catch block.

21) What is the difference between instanceof() and isInstance()?


instanceof() is used to see whether the object can be typecast without
making use of the exception.
isInstance() is to check whether the specified object is compatible with
the class that represent the object.

22) How can you achieve multiple inheritance in java?


Multiple inheritance in java implemented in similar to the C++ with one
difference the inherited interface should be abstract.

23) What is the difference between == and equals methods?


‘==’ is used to check whether two numbers are equal
‘Equals’ is used to check whether two strings are equal.
24) What are java beans?
Java bean is a platform independent and portable. It helps to develop
code that is possible to run in any environment

25) What is RMI?


RMI stands for remote method invocation; it enables the developer to
create application based on java, in which the java objects are invoked by
java virtual machine.

C QUESTIONS

What are Macros?

Macros are preprocessor, it’s unique feature of C language.


Preprocessor improves the readability of the program and hence the
developed code is more efficient.

Preprocessor directives consist of three sub categories

•Macro substitution division

•Complier control division

•File inclusion division

2) What is the difference between char *a and char a[]?

Char a[] = “Name”

The above statement allocates 5 memory location, for the above


declared statement.

Char *a = “Name”
in front of a shows pointer declaration. The complier asks to place to
hold the pointer. Memory address will given the name ‘a’ and it points to the
array of seven character.

3) What is the difference between malloc() and calloc()?

The two functions mainly is to allocate memory and they are commonly
called as memory managers.

Malloc() :- Malloc function take one argument

Calloc() :- Calloc function take two argument in a time. The bits in the
allocated space are initialized to zero.

4) When should a type cast not be used?

Program which uses const declaration should not override using type
cast. This will cause the program not to run sucessfuly. Type cast cannot
be used to turn pointer from one data type to another.

5) When is a switch statement better than multiple if statements?

Switch statement is better used when it required to check more then one
condition with the same variable. A switch statement check the condition
only ones.

6) Define and explain scanf () function?


Scanf() function get the input from the user. It contains two argument.

First argument: - specify the datatype

For example: - %f This tells that the value will be in floating point

Second argument: - name in which the data to be stored

For example: - &f1 the entered value is stored in f1.

7) Explain ‘variable scope’, ‘local scope’ and ‘global scope’ ?

Any variable declared inside the function are said to be local variable.
These variable have meaning only within the function. Any variable
declared outside the function are said to be global variable

Scope of the variable: - the extent to which a variable is accessible is


said to be scope of the variable.

8) What are signed variables?

When a variable is initialized as integer, it can take positive or negative


this is called as signed variables. Range of value that the variable can hold
depend on the system.

9) What is operator precedence?

Operator precedence, tells the order in which the c complier executes a


expression. It uses the BODMAS rule
Brackets first

Orders (ie Powers and Square Roots, etc.)

Division and Multiplication (left-to-right)

Addition and Subtraction (left-to-right)

10) What is stack?

Stack operates under the rule of last in, first out. It contains two basic
operations Pop and push. A stack can hold any data type. Stack doesn’t
perform flexible operation.

11) Explain about the functions strcat() ?

Strcat() function is used to concatenate the strings. It appends a copy of


the string in the source to the destination location

For example:- strcat(str, “C”)

Strcat(str, “programming”)

Output :- C programming

12) Explain strcmp()?

Strcmp() function, compares to string character by character if any


mismatch occurs then it will return the difference between the non matching
value in ASCII code else if two strings compared till the end and they are
same, then it return the value zero.

13) Difference between union and structure?

Union and structure groups different variables together. UNION treats


different variable with same memory space whereas structure uses
different space for different variable.

14) What is Register variable?

Register variable are automatic variable. Register variable stores the


data in the CPU. Storing and retrieval of data are quiet easy. Variables that
are used repeatedly in the program can be stored as register variable for
easy storage and retrieval.

15) State some significant uses of arrays in C programming?

Elements in a array are for char data type and can store single
character in each element. The significant use of array is that the ability to
store the strings as text.

16) What is heap?

Heap allocates memory for malloc(), realloc and calloc. It is more


flexible then stack.
17) What is memory leak?

An allocated memory which is no longer needed but the memory space


is not deallocated.

18) What are the basic data types in C?

Four data types in C

Int

Float

Char

Double

19) List any two format specifiers?

%d can hold integer whole number.

%c can hold single character value.

20) Define and explain about! Operator?

It is a unary operator which is used before single operator. The not


operator return the inverse value. It is used in programming which require
to change the value of the variable.
21) What is static variable?

Static variable are constant variable whose value remain the same
throughout the program. Static variable are instant variable

22) How can you determine the size of an allocated portion of the memory?

The malloc or free implementation would determine the size of the


memory easily.

23) Why do we use structure?

Structures are used for various purpose

o Use of structure variable

o To develop individual array.

24) Define these functions fopen(), fread(), fwrite() and fseek()?

Fopen():- function to open a file, the pointer points to the first record in
the file.

Fread():- it reads the file were the pointer is pointing.

Fseek():- This function enables to move from one record to another.

Fwrite:- This function write data in the file were the pointer is pointing.
25) What are logical operators in C?

Logical operators in C are AND and OR operator.

AND denoted by && for example exp1&& exp2

OR denoted by || for example exp1||exp2

You might also like