Download - INTERVIEW QUESTIONS C AND JAVA
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
1/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 moreadvantageous 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. HashMapdoesnt guarantee that the map order will be maintained.
3. What is the difference between a constructor and amethod?
A constructor is member function and it is used to createobject of the class. It assigns the same name as that in theclass, and has no return type. Whereas method is a ordinarymember function, which has own name and return type. Theyare 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 speedHigh 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 programfor alloction of resources and reclaiming them. Java virtualmachine tries to recycle the unused object, but there is noguarantee 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
2/39
are as follows:-Short
IntByte
FloatChar
longBoolean
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 beinvoked, which will fire off a garbage collection at that time
9. What are the differences between JIT and HotspotJIT is a compiler whereas Hotspot is a collection of techniques,also called as optimization.Java hotspot is a core component of the Java platform. Itimplements 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 stringwith another string a new string object is created.But in case ofStrinBuffer 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. Thetype 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
3/39
of the string in the class, Whereas length is just used for arrayto find the length of the array.
14. What is synchronization and why it is important?
Synchronization occurs when the programmer want to runtwo thread at a time which shares some property.Synchronization is the process that control access to multiplethreads 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 isinheritance 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 classesAnonymous classes
Nested top- level classesMember 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 majordifference between member and nested top level class is that itcan access specific instance of the corresponding class.
19. What is the difference between error and exception?
An error that occurs during runtime is not recoverablewhereas in most of the cases an exception can be recovered ifit 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
4/39
by catch blockList out the desired exception in throw and the caller of the
method handlethe exception
21. If I write System.exit (0); at the end of the try block, willthe finally block still execute?
When you type System.exit(0) in the end it indicates thecompiler to stop compiling and execute of the program, thusthe 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 invokesthe update() method of each of its observers to notify theobservers that it has changed state. The Observer interface isimplemented by objects that observe Observable objects.
23. How does Java handle integer overflows andunderflows?
Java handles integer overflow and underflows usinglow order bytes that fit in the size of the type that is allowed bythe 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 appletare from same class it can communicate using static variable,
when the applet are of different class it can communicatethrough reference.
How does a try statement determine which catch clauseshould be used to handle an exception?
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
5/39
When an exception is thrown within the body of a trystatement, the catch clauses of the try statement are examinedin the order in which they appear. The first catch clause that iscapable 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 ofcode?MyClass c1, c2, c3;
c1 = new MyClass ();c3 = new MyClass ();
c1 and c3 are the two objects created. The c2 is onlydeclared 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 anarray defined as an instance variable?
If the array is of primitive data type then the elements of thearray is initialized to default value. If the array is of referencetype 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
InstanceStatic
8. What is the default value of the local variables?
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
6/39
When the local variables are not initialized explicitly the javacompiler will not compile. And it will not initialize any defaultvalue 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 sizeof an object?
There is no sizeof operator in java. It is not possible todetermine 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 isnot possible to have duplicate keys. It is essential that eachkey should map to a one value.Three Map implementations areHashmapLinkedHashmapTreemap
12. What is collection Views?
Collection view is a metho that is used to view map as acollection. This can be done in three ways:-ValuesKeysetEntryset
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. Its much more simple to use map whosevalues 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 doesnt handle anychanges.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
7/39
public class SimpleTimeZoneextends 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
AbstractStatic 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 thatcauses the object to accessible.
19. What happens when you add a double value to aString?
When double value is added to the string it becomes a stringobject.
20. What is Layout Managers? It is an object that implements LayoutManager interface and
also determines the position and size of the components withina container.
Some of the task associated with layout manager are asfollows:-
Adding space between componentsAdding 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
8/39
specifications, just as the inside of a sig end signatureexpression. The implementation contains a sequence ofdefinitions, just as the inside of a struct end moduleexpression
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. Thelong and float values are converted to double values, asrequired.
24. Which arithmetic operations can result in the throwingof an ArithmeticException?
Integer / and % can result in the throwing of anArithmeticException.
25. What is the ResourceBundle class?
It contains locale specific objects. If a program requireslocale specific resources then the program can load resourcebundle that is appropriate for the current user. Advantage:-
Make it localized, and can be translated into differentlanguages.
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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
9/39
NULL macro?A NULL pointer is a pointer that points to nothing. It can besome other address in another system or 0 in case ofUNIX/Linux system. Using the NULL macro to set/initialize your
pointers will make your programs more portable amongsystems than using something like the 0.
3.What do the c and v in argc and argv stand for?c in argc stands for countv in argv stands for vector
4. Which Bit wise operator is used to determine whether aparticular bit is on or off?
The Bit wise OR | operator can be used to checkwhether particular bit is on or off.
5. Can you dynamically allocate arrays in expandedmemory?
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 filesin(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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
10/39
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 tothe 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??
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
11/39
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
12/39
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?
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
13/39
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 twocharacters 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.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
14/39
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?
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
15/39
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 ajob, may not be present in all the candidates. Skills required forthe job may not be present in the candidate, and even therecruiter doesnt expect that the job applicant should have allthe skill. Rather the job aspirant should have a willingness tolearn skills that the individual doesnt possess.
It is not possible for all the applicants to talk in Americanaccent, if the applicant doesnt possess the skill he/she shouldhave the willingness to learn.
2) What are your biggest weaknesses?No person is without any weakness. If a job applicant says
that he/she doesnt have any weakness, that doesnt mean the
interviewer that the candidate is 100% perfect. Each and everyperson have some kind of weakness, while specify in theinterview care should be taken that these weakness should notaffect the job.
While specifying the weakness the job seeker should alsoprovide the steps that he/she taking, inorder to overcome the
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
16/39
weakness. The job seeker should be able to convert theweakness also positive at to be able to make use of the skill inthe 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 aboutthemelf, whether they choose the right filed that fits their skillsets and knowledge that will help them to make use of theskills effectively.
To answer the above question, it is essential for job seekerto know about the BPO industry inorder to speak about theindustry in the interview.
BPO is nothing but business process outsourcing, which ingeneral means outsourcing the business process. It is aprocess of hiring company to handle the business process.
This question is basically to check the awareness aboutBPO in the job seeker and also the willingness to work in theindustry.4) What would u do, if you become a prime minister ofyour 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. Thisalso shows the readiness of the job seeker to takeresponsibility and well ho/she could perform effectively in anorganization.
Always have a positive approach while answering suchquestion. Answer with a realistic approach. Convey thingswhich 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. Themajor differences exist in work environment.
Answer to the above question will give a clear picture to theHR that you very well know about the industry. It will make thetask of the recruiter easier in finding the right job that matches
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
17/39
the job seeker.Traditional cal centre or domestic call centre involves
outsourcing, who Place their call centers around nativecountry. 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 youwant to do , which you were not able to do in ur previouscompany?
This is to ensure the commitment towards the job. As soonas you join the company the main goal of the job seeker should
be able to fulfill the task and responsibility given to you. Theapplicant should be able to expand the skill and task apart fromthe normal task assigned to him/her.
7) Are you confident of your communicative skills inconvincing people?
As the call centre job purely requires the skill to convincepeople. Thus the call centre executives require to convince thecustomer inorder to retain the customer.
While answering such question show your confidence andtry to create an impression that you can best convince all kindof people.
Never be negative while you answer such question,eventhough you are not that good in convincing the customeryour answer should be yes I would be effective communicatorwith the people.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
18/39
8) Which one do you think web or voice suits yourqualifications better?
If you have a complete focus on either voice or web, you can
tell about your preference to the recruiter. Have valid reasonfor 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 ofenvironment. Applying for a call centre and not interested inworking for shift base job, will not help the job seeker to getselected.
So the main objective of the job seeker is to show thewillingness 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 whileanswering such question. He/She should specify realisticposition that could be attained in these three years.
The job seeker requires to be aware of the positions in theindustry and what position can be achievable within three
years. This will help to communicate the right position in threeyears.
11) What If Some Other Company Offers You More Thanus?
This question tells how far you are stable in choosing a job.Genenrally job seekers have one or three offers in hand so thatthey 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 youwill 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 workingfor this company. Even though some other company offer memore package then your company, I would still opt for thiscompany since it provide a good work environment and better
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
19/39
job satisfacAlways have your answer that are realistic and that reliable.
It should create a trust on the recruiter that you will join thecompany.
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 ofthe companies have centralized customer services andfunctions 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 shouldbe 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 workenvironment that he/she will be put up.
13) What are the Call Center and Customer Service mainobjectives?
This will help the recruiter how far he/she will be able tosatisfy 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 muchessential to sustain as well for future progress of theorganization. Call centre consist of different kinds of customerand of different type. Inorder to create an awareness about thecustomer 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 thathe/she able to convince the customer.
You could develop your own strategy to provide bettersatisfaction to the customer.
* Better assisting the customer.* Identifying the problem and solve them in effective way.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
20/39
* Keeping track with the customer after the service has beenprovided
The above points help to better serve the customer.
15) The procedure you should take when speaking with acustomer?
Questions asked in the interview not only rely on theexperience 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 maingoal of the executive is to satisfy the customer and able toresolve 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, whiledescribing the same in the interview, care to be taken whileanswering the question. since the answer decide whether toselect the job seeker or not. The best way to convince therecruiter is by emphasizing on your personal traits that best fitin this job. Apart from these the job seeker should have a goodknowledge about the BPO industry this will show theinvolvement 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 theapplicant. The job seeker can provide valuable reason such assince there is no much progress in my previous job and I amlooking for better opportunity.
18) why do you want to join a call centre being a computerscience graduate?
Careful attention job seeker requires to have since this willgive the view what the job seeker have about the call centre.Answer:-
Call centre is an international business, where I couldconfront different types of people, It helps me to developcommunication skill. salary and bonus also attracts me to joinin call centre. Its purely a performance based job, develop a
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
21/39
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 ofsecondary choice.
19) What is your greatest strength?
Before answering such question the job seeker require toprepare themself to answer, since this the most frequentlyasked question in the interview. Identify the strength that canbest sell yourself in the job market.
While specifying the strength, the job seeker should becapable in relating to the job position that has been posted. Jobseeker 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 inworking in such environment.
The job seeker should always create more chance for therecruiter to select you, this requires lot of talent on the jobseeker side. Thus the job seeker should show the willingnessto 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. Therecruiters will be able to analyze whether the candidate right fitinto 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 therecruiter also easier. Computer skills play a vital role in the
selection process.Describe your skills quantitatively that will figure out youeffectively in an interview.
For example if you are going to take up an job for data entryyou require typing speed, the recruiter will mainly look forproficiency in typing.JAVA QUESTIONS
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
22/39
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 issupported 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++ doesnt.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
23/39
C++ supports destructor whereas java doesnt 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 weightcomponents.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 doesnt 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
24/39
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 classmethod.
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 doesnt 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?-
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
25/39
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 atime. 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 instantvariable
2) How can you determine the size of an allocated portionof the memory?
The malloc or free implementation would determine the sizeof 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() andfseek()?
Fopen():- function to open a file, the pointer points to the firstrecord 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&& exp2OR denoted by || for example exp1||exp2
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
26/39
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: falseIt 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 scoreAll 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
27/39
easily identify source code address and can modify the sourcecode. It is possible to access even the restricted memoryspace.
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 theexecution 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 intostring.
16) What are the advantages of the functions?Testing is much easier
More readabilityImproves 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. Externalstatic variable declared outside the function and have scopethroughout 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 preprocessorwould include it. It is always advisable that the programsshould 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.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
28/39
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 whencompared 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
29/39
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 informationwhich 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 doesnt 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
30/39
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 tosystem.
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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
31/39
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.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
32/39
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, its 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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
33/39
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 conditiononly ones.
6) Define and explain scanf () function?
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
34/39
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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
35/39
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 doesnt
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
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
36/39
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.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
37/39
17) What is memory leak?
An allocated memory which is no longer needed but the memory spaceis 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.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
38/39
21) What is static variable?
Static variable are constant variable whose value remain the samethroughout 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.
-
8/7/2019 INTERVIEW QUESTIONS C AND JAVA
39/39
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