Top 100+ Tcs Technical Interview Questions And Answers
Question 1. Differences Between C And Java?
Answer :
JAVA is Object-Oriented whilst C is procedural.
Java is an Interpreted language at the same time as C is a compiled language.
C is a low-level language at the same time as JAVA is a high-level language.
C makes use of the top-down method whilst JAVA uses the lowest-up method.
Pointer go behind the curtain in JAVA while C requires express coping with of hints.
The Behind-the-scenes Memory Management with JAVA & The User-Based Memory Management in C.
JAVA supports Method Overloading at the same time as C does not aid overloading at all.
Unlike C, JAVA does not support Preprocessors, & does no longer absolutely them.
The popular Input & Output Functions--C uses the printf & scanf capabilities as its popular input & output at the same time as JAVA uses the System.Out.Print & System.In.Study capabilities.
Exception Handling in JAVA And the mistakes & crashes in C.
Question 2. In Header Files Whether Functions Are Declared Or Defined?
Answer :
Functions are declared inside header report. That is function prototypes exist in a header record,no longer function bodies. They are described in library (lib).
Question 3. What Are The Different Storage Classes In C ?
Answer :
There are 4 types of storage classes in C. They are extern, sign up, automobile and static
Question 4. What Does Static Variable Mean?
Answer :
Static is an get admission to qualifier. If a variable is said as static internal a feature, the scope is restrained to the feature,however it's going to exists for the life time of this system. Values could be continued among successive calls to a feature.
Question 5. How Do You Print An Address ?
Answer :
Use %p in printf to print the cope with.
Question 6. What Are Macros? What Are Its Advantages And Disadvantages?
Answer :
Macros are processor directive to be able to get replaced at collect time.
The disadvantage with macros is that they just update the code they're now not characteristic calls. In addition the advantage is that they can reduce time for replacing the equal values.
Question 7. Difference Between Pass By Reference And Pass By Value?
Answer :
Pass by using price just passes the price from caller to calling characteristic so the known as characteristic can not regulate the values in caller feature. But Pass by way of reference will skip the deal with to the caller feature instead of fee if known as feature requires to regulate any cost it could immediately regulate.
Question eight. What Is An Object?
Answer :
Object is a software program bundle of variables and associated strategies. Objects have nation and conduct
Question 9. What Is A Class?
Answer :
Class is a consumer-defined records type in C++. It may be created to clear up a specific sort of problem. After introduction the consumer want no longer recognize the specifics of the operating of a category.
Question 10. What Is The Difference Between Class And Structure?
Answer :
Structure: Initially (in C) a structure turned into used to package specific sort of statistics types together to carry out a specific functionality. But C++ extended the shape to contain capabilities additionally.
The predominant distinction is that every one declarations interior a shape are with the aid of default public:
Class: Class is a successor of Structure. By default all the members in the magnificence are personal.
Question eleven. What Is Pointer?
Answer :
Pointer is a variable in a program is something with a call, the cost of that could vary. The way the compiler and linker handles that is that it assigns a selected block of reminiscence in the pc to preserve the value of that variable.
Question 12. What Is The Difference Between Null And Void Pointer?
Answer :
A Null pointer has the fee 0. Void pointer is a standard pointer added by using ANSI. Generic pointer can hold the deal with of any data kind.
Question 13. What Is Function Overloading And Operator Overloading?
Answer :
Function overloading: C++ enables numerous features of the identical name to be described, as long as those functions have one-of-a-kind sets of parameters (at least as some distance as their kinds are involved). This functionality is known as feature overloading. When an overloaded characteristic is referred to as, the C++ compiler selects the right characteristic by means of analyzing the quantity, kinds and order of the arguments in the call. Function overloading is commonly used to create numerous capabilities of the same call that perform comparable obligations but on unique facts kinds.
Operator overloading lets in current C++ operators to be redefined so they work on objects of user-defined training. Overloaded operators are syntactic sugar for equal feature calls. They shape a nice facade that doesn't upload anything essential to the language (however they can improve understandability and reduce maintenance charges).
Question 14. What Is Friend Function?
Answer :
A friend function for a category is used in item-oriented programming to allow access to public, personal, or covered facts in the class from the out of doors.
Normally, a function that isn't a member of a class can't access such records; neither can an external elegance. Occasionally, such access will be high-quality for the programmer. Under those situations, the characteristic or external class may be declared as a chum of the elegance using the pal keyword.
Question 15. What Do You Mean By Inline Function?
Answer :
The idea in the back of inline functions is to insert the code of a called function on the point where the feature is called. If done carefully, this can enhance the utility's performance in exchange for improved bring together time and probable (however no longer continually) an boom within the length of the generated binary executables.
Question sixteen. Tell Me Something About Abstract Classes?
Answer :
An summary magnificence is a class which does not absolutely constitute an object. Instead, it represents a large variety of different training of items. However, this illustration extends best to the features that the ones classes of items have in common. Thus, an summary class offers most effective a partial description of its gadgets.
Question 17. What Is The Difference Between Realloc() And Free()?
Answer :
The unfastened subroutine frees a block of memory previously allocated through the malloc subroutine. Undefined outcomes occur if the Pointer parameter isn't a legitimate pointer. If the Pointer parameter is a null fee, no movement will occur. The realloc subroutine adjustments the dimensions of the block of memory pointed to by way of the Pointer parameter to the range of bytes particular by way of the Size parameter and returns a brand new pointer to the block. The pointer precise by means of the Pointer parameter must had been created with the malloc, calloc, or realloc subroutines and no longer been deallocated with the loose or realloc subroutines. Undefined results arise if the Pointer parameter isn't a legitimate pointer.
Question 18. What Is The Difference Between An Array And A List?
Answer :
Array is series of homogeneous factors. List is collection of heterogeneous factors.
For Array memory allotted is static and continuous. For List memory allocated is dynamic and Random.
Array: User want no longer need to preserve in song of next reminiscence allocation.
List: User has to maintain in Track of next area wherein reminiscence is allotted.
Array uses direct get admission to of stored participants, listing uses sequential access for individuals.
Question 19. What Are The Differences Between Structures And Arrays?
Answer :
Arrays is a collection of comparable statistics sorts but Structures can be organization of various data kinds.
Question 20. What Is Data Structure?
Answer :
A data structure is a manner of organizing facts that considers now not best the items saved, but additionally their relationship to every different. Advance expertise approximately the relationship between facts items lets in designing of efficient algorithms for the manipulation of statistics.
Question 21. Can You List Out The Areas In Which Data Structures Are Applied Extensively?
Answer :
Compiler Design,
Operating System,
Database Management System,
Statistical analysis package,
Numerical Analysis,
Graphics,
Artificial Intelligence,
Simulation
Question 22. What Are The Advantages Of Inheritance?
Answer :
It permits code reusability. Reusability saves time in software improvement. It encourages the reuse of confirmed and debugged high-quality software, accordingly lowering hassle after a gadget will become purposeful.
Question 23. What Are The Two Integrity Rules Used In Dbms?
Answer :
The kinds of integrity guidelines are referential integrity rules and entity integrity regulations. Referential integrity regulations dictate that a database does now not incorporate orphan overseas key values. This means that A primary key cost cannot be modified if the price is used as a foreign key in a toddler desk. Entity integrity dictates that the primary key cost cannot be Null.
Question 24. Tell Something About Deadlock And How Can We Prevent Dead Lock?
Answer :
In an operating machine, a impasse is a situation which takes place while a procedure enters a waiting country because a aid requested by way of it's miles being held by any other ready process, which in turn is looking ahead to another useful resource. If a method is not able to trade its state indefinitely due to the fact the resources requested via it are being used by other ready technique, then the machine is said to be in a deadlock.
Mutual Exclusion: At least one resource ought to be non-shareable.[1] Only one system can use the useful resource at any given immediate of time.
Hold and Wait or Resource Holding: A method is presently conserving as a minimum one aid and asking for additional sources that are being held via different methods.
No Preemption: The running machine need to not de-allocate sources once they had been allotted; they must be released by way of the conserving method voluntarily.
Circular Wait: A process ought to be anticipating a resource that is being held with the aid of another method, which in turn is anticipating the primary manner to launch the useful resource. In trendy, there is a hard and fast of ready techniques, P = P1, P2, ..., PN, such that P1 is watching for a aid held by means of P2, P2 is anticipating a aid held by means of P3 and so on until PN is looking ahead to a resource held by using P1.[1][7]
Thus prevention of deadlock is possible by way of making sure that at least one of the four conditions can not keep.
Question 25. What Is Doubly Link List?
Answer :
A doubly related list is a linked records structure that includes a set of sequentially related facts known as nodes. Each node carries two fields, called links, which might be references to the previous and to the subsequent node inside the series of nodes. The starting and finishing nodes' previous and subsequent hyperlinks, respectively, factor to some form of terminator, generally a sentinel node or null, to facilitate traversal of the listing. If there is handiest one sentinel node, then the listing is circularly connected via the sentinel node. It can be conceptualized as two singly related lists fashioned from the identical information objects, however in contrary sequential orders.
Question 26. What Is Data Abstraction? What Are The Three Levels Of Data Abstraction With Example?
Answer :
Physical level : how the statistics is stored bodily and in which it's miles saved in database.
Logical stage : what information or data is saved inside the database. Eg: Database administrator
View stage : give up users work on view stage. If any amendment is made it is able to be saved through different name.
Question 27. What Is Command Line Argument?
Answer :
Getting the arguments from command set off in c is called command line arguments. In c foremost feature has 3 arguments.They are:
Argument counter
Argument vector
Environment vector
Question 28. Advantages Of A Macro Over A Function?
Answer :
Macro receives to look the Compilation environment, so it is able to extend #defines. It is elevated with the aid of the preprocessor.
Question 29. What Are The Different Storage Classes In C?
Answer :
Auto,sign in,static,extern
Question 30. Which Header File Should You Include If You Are To Develop A Function Which Can Accept Variable Number Of Arguments?
Answer :
stdarg.H
Question 31. What Is Cache Memory ?
Answer :
Cache Memory is used by the important processing unit of a pc to reduce the common time to access reminiscence. The cache is a smaller, faster reminiscence
which stores copies of the statistics from the maximum frequently used main memory places. As lengthy as most memory accesses are cached reminiscence places, the average
latency of reminiscence accesses might be closer to the cache latency than to the latency of foremost memory.
Question 32. What Is Debugger?
Answer :
A debugger or debugging device is a laptop software this is used to test and debug other applications
Question 33. Const Char *p , Char Const *p What Is The Difference Between The Above Two?
Answer :
const char *p - Pointer to a Constant char ('p' isn't always modifiable however the pointer is)
char const *p - Also pointer to a regular Char
However if you had something like:
char * const p - This proclaims 'p' to be a regular pointer to an char. (Char p is modifiable however the pointer isn't)
Question 34. What Is Memory Alignment?
Answer :
Data structure alignment is the way information is arranged and accessed in laptop memory. It consists of two separate however related problems: facts alignment and statistics shape padding.
Question 35. Explain The Difference Between 'operator New' And The 'new' Operator?
Answer :
The distinction among the two is that operator new simply allocates raw reminiscence, not anything else. The new operator starts with the aid of the use of operator new to allocate memory, however then it invokes the constructor for the proper kind of object, so the end result is a real live object created in that memory. If that object includes any other objects (either embedded or as base training) those constructors as invoked as properly.
Question 36. Difference Between Delete And Delete[]?
Answer :
The key-word delete is used to wreck the single variable reminiscence created dynamically that is pointed via single pointer variable.
Eg: int *r=new(int)
the memory pointed with the aid of r may be deleted by means of delete r.
Delete [] is used to damage array of memory pointed via single pointer variable.
Eg:int *r=new(int a[10])
The reminiscence pointed by means of r may be deleted by using delete []r.
Question 37. What Is Conversion Constructor?
Answer :
A conversion constructor is a single-parameter constructor that is declared with out the function specifier 'specific'. The compiler makes use of conversion constructors to transform objects from the sort of the primary parameter to the type of the conversion constructor's magnificence.To outline implicit conversions, C++ makes use of conversion constructors, constructors that be given a single parameter and initialize an item to be a replica of that parameter.
Question 38. What Is A Spanning Tree?
Answer :
A spanning tree is a tree associated with a network. All the nodes of the graph appear at the tree once. A minimal spanning tree is a spanning tree organized in order that the full area weight between nodes is minimized.
Question 39. Why Should We Use Data Ware Housing And How Can You Extract Data For Analysis With Example?
Answer :
If you need to get statistics on all of the techniques of designing, retaining, constructing and retrieving records, Data warehousing is the best method. A statistics warehouse is premeditated and generated for assisting the selection making manner inside an organization.
Here are some of the advantages of a records warehouse:
With facts warehousing, you may offer a not unusual records version for extraordinary hobby areas regardless of information's source. In this manner, it becomes easier to record and analyze facts.
Many inconsistencies are identified and resolved before loading of statistics in facts warehousing. This makes the reporting and studying procedure simpler.
The fine part of data warehousing is that the records is under the manage of users, so that during case the device gets purged over time, records may be effortlessly and safely stored for longer time period.
Because of being one-of-a-kind from operational structures, a records warehouse facilitates in retrieving statistics with out slowing down the operational system.
Data warehousing complements the cost of operational enterprise applications and consumer relationship control systems.
Data warehousing additionally ends in proper functioning of guide system applications like fashion reports, exception reports and the actual overall performance reading reviews.
Data mining is a effective new era to extract records for evaluation.
Question forty. Explain Recursive Function & What Is The Data Structures Used To Perform Recursion?
Answer :
a) A recursive feature is a feature which calls itself.
B) The velocity of a recursive software is slower because of stack overheads. (This characteristic is obvious in case you run above C program.)
c) A recursive feature must have recursive conditions, terminating conditions, and recursive expressions.
Stack information structure . Because of its LIFO (Last In First Out) property it recollects its caller so is aware of whom to go back while the function has to return. Recursion makes use of gadget stack for storing the return addresses of the function calls. Every recursive feature has its equivalent iterative (non-recursive) feature. Even while such equivalent iterative strategies are written, explicit stack is to be used.
Question 41. Differentiate Between Compiler And Interpreter?
Answer :
An interpreter reads one training at a time and includes out the actions implied by that preparation. It does no longer carry out any translation. But a compiler interprets the entire commands
Question forty two. What Is Scope Of A Variable?
Answer :
Scope refers back to the visibility of variables. It is very beneficial to be able to restriction a variable's scope to a unmarried feature. In other phrases, the variable wil have a constrained scope
Question forty three. What Is An Interrupt?
Answer :
Interrupt is an asynchronous sign informing a software that an occasion has came about. When a program gets an interrupt sign, it takes a distinct motion.
Question forty four. What Is User Defined Exception In Java?
Answer :
The key phrases utilized in java application are strive, seize and subsequently are used in imposing used-described exceptions. This Exception elegance inherits all the technique from Throwable class.
Question 45. What Is Java Applet?
Answer :
Applet is java application that may be embedded into HTML pages. Java applets runs at the java allows net browsers consisting of mozila and internet explorer. Applet is designed to run remotely on the consumer browser, so there are some restrictions on it. Applet can't access gadget sources at the local computer. Applets are used to make the internet web page extra dynamic and wonderful.
Question 46. What Do You Know About The Garbage Collector?
Answer :
Garbage series is the systematic recovery of pooled pc garage this is being utilized by a application while that application now not desires the storage. This frees the storage to be used by using different programs
(or techniques inside a application). It also ensures that a program using growing quantities of pooled storage does no longer attain its quota (in which case it may now not be able to feature).
Garbage collection is an automatic memory control function in lots of modern-day programming languages, including Java and languages inside the .NET framework. Languages that use garbage series are often interpreted or run within a digital gadget like the JVM. In each case, the surroundings that runs the code is also liable for rubbish series.
Question forty seven. Write A Binary Search Program...........
Answer :
int binarySearch(int arr[],int length, int object)
int left, proper, middle;
left = zero;
proper = size-1;
at the same time as(left <= right)
middle = ((left + right)/2);
if(item == arr[middle])
return(middle);
if(item > arr[middle])
left = middle+1;
else
right = center-1;
go back(-1);
Question 48. What Are Enumerations?
Answer :
An enumeration is a facts type, used to declare variable that shop listing of names. It is act like a database, so that it will store listing of objects in the variable. Instance: enum shapestriangle, rectangle,...
Question 49. What Is Static Identifier?
Answer :
The static identifier is used for initializing most effective as soon as, and the value keeps at some stage in the life time of this system / application. A separate memory is allocated for ?static? variables. This price may be used between characteristic calls. The default value of an uninitialized static variable is zero. A feature can also be described as a static feature, which has the same scope of the static variable.
Question 50. What Is Cryptography?
Answer :
Cryptography is the technological know-how of permitting at ease communications among a sender and one or greater recipients. This is executed by the sender scrambling a message (with a computer program and a mystery key) and leaving the recipient to unscramble the message (with the same laptop software and a key, which might also or may not be similar to the sender's key).
There are two types of cryptography: Secret/Symmetric Key Cryptography and Public Key Cryptography
Question 51. What Is Encryption?
Answer :
Encryption is the transformation of data from readable form into some unreadable form.
Question 52. What Is Decryption?
Answer :
Decryption is the opposite of encryption; it is the transformation of encrypted information back into a few intelligible shape.
Question fifty three. What Exactly Is A Digital Signature?
Answer :
Just as a handwritten signature is affixed to a broadcast letter for verification that the letter originated from its purported sender, digital signature performs the same undertaking for an piece of email. A virtual signature is an encrypted model of a message digest, attached collectively with a message.
