C is a general purpose high-level language most popular amongst coders, it is the most compatible, easy to learn and effective programming language. It is a successor of the B language that came out way back in the 70s and has been the most popular programming language ever since.
Following are some important C Interview Questions
1. When should we use pointers in a C program?
a. To get address of a variable
b. For achieving pass by reference in C: Pointers allow different functions to share and modify their local variables.
c. To pass large structures so that complete copy of the structure can be avoided.
d. To implement “linked” data structures like linked lists and binary trees.
Ans:
Ans: NULL is used to indicate that the pointer doesn’t point to a valid location. Ideally, we should initialize pointers as NULL if we don’t know their value at the time of declaration. Also, we should make a pointer NULL when memory pointed by it is deallocated in the middle of a program.
Ans: Dangling Pointer is a pointer that doesn’t point to a valid memory location. Dangling pointers arise when an object is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory. Following are examples.
Ans: Memory leak occurs when programmers create a memory in heap and forget to delete it. Memory leaks are particularly serious issues for programs like daemons and servers which by definition never terminate.
a) The expression ‘i++’ returns the old value and then increments i. The expression ++i increments the value and returns new value.
b) Precedence of postfix ++ is higher than that of prefix ++.
c) Associativity of postfix ++ is left to right and associativity of prefix ++ is right to left.
d) In C++, ++i can be used as l-value, but i++ cannot be. In C, they both cannot be used as l-value.
When using Call by Value, you are sending the value of a variable as parameter to a function, whereas Call by Reference sends the address of the variable. Also, under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the function.
The typecasting is a process of converting one data type into another data type. Suppose If we want to store the floating type value to an int type, then we will use typecasting to convert floating point data type into int data type explicitly.
Ex: int i = (int) 3.4
In dynamic memory allocation, memory is allocated at runtime. We can increase memory while executing the program. The malloc() or calloc() function is used to allocate the memory at the runtime. Dynamic memory allocation is used in linked list.
In static memory allocation, memory is allocated during compile time. And we cannot increase memory while executing the program. Array use the static memory allocation. lifetime of a variable in static memory is the lifetime of the program. It applies to global variables, file scope variables etc.The static memory is implemented using stacks or heap.
For example: int arr[20]; The above example creates an array of integer type, and the size of an array is fixed, i.e., 20.
Ans. The only difference between the two roles is that one reads characters from the keyboard and the other does not. getch() is a function that reads characters from the keyboard without using any buffers. As a result, no data is shown on the computer. getche() uses a buffer to read characters from the keyboard. As a result, information is shown on the projector.
If you're looking to prepare for a job in the tech industry, Data Structures and Algorithms (DSA) are essential to master. Practising problems on plat......
Each and every programmer needs a strong grasp in DSA to write efficient and optimised codes. However, DSA has a reputation of being one of the most f......
Its that time round the calendar again, but different for you all as for the first time now. You all will be facing the on campus placement season.Wit......
WHAT IS WEB3?Web3 is the catch-all term for the vision of an upgraded version of the internet aimed at giving power back to the users. It is truly the......
Operating Systems is one of the core subjects for a computer science student. As such a lot of important questions are asked on this subject in interv......
Cognizant helps organizations remain ahead of the competition by modernizing technology, reinventing processes, and redefining customer experiences. I...
Getting started with cloud computing ?The words "cloud" and "web" will be interchangeable. What kind of business operates today without the internet? ...
SOFTWARE MAINTENANCE:Software Maintenance can be defined as the process of modifying a software product after its delivery. The main purpose of softwa...
A quick summary upto what we did this far from this series:Software EngineeringSoftware engineering is a discipline of engineering concerned wit...
Capgemini is a global leader in consulting, digital transformation, technology, and engineering services. In the rapidly evolving world of cloud, digi...
Technical Round :Candidates who pass the online test will be invited to the technical interview...
About Mindtree:Mindtree Ltd, located in Bangalore, India, is a prominent Indian multinational information technology and outsourcing company. The ...
TCS NQT Interview kicks off with the aptitude test. The test follows the following pattern : TCS uses the TCS-iON software for their online aptit...
Increased competition for fewer jobs in the current economy means that just being right for the role on paper, is not enough on its own anymore. You h...
About TCS NinjaTCS administers the NQT to select candidates for a variety of positions (National Qualifier Test). Tens of thousands of people apply fo...
Introduction:Understanding time complexity of a function is imperative for every programmer to execute a program in the most efficient manner. Time co...
Software MethodologyA software methodology (which is also known as software process) is a set of related development Phases that leads to the pr...
About TCS DigitalTCS selects applicants for a variety of jobs by conducting the NQT (National Qualifier Test). About 10,000-15,000 job applicants subm...
Software Engineering is a subject that requires when you are a software developer as well as when you are in your college preparing for a semester or ...
Are you getting ready for your SQL developer job interview?You've come to the correct place.This tutorial will assist you in brushing up on your SQL s...
Introduction: What is SQL?To understand SQL, we must first understand databases and database management systems (DBMS).Data is essentially a collectio...
TCS Recruitment ProcessInterview RoundsInterview round 1: TCS NQTTCS NQT (National Qualifier T...
TCS NQT Aptitude has three sections, namely the Numerical Ability, Verbal Ability, and Reasoning Abi...
About TCS NQTTCS NQTs, also known as TCS National Qualifier Tests or Tata Consultancy Services Natio...
Networking: Importance in real life!Using a computer for work, as well as for personal use, ha...
ER-DiagramWhat are ER Models ?An Entity Relationship Diagram (ERD) is a visual representation of dif...
What is actually DBMS?A Database Management System (DBMS) is system software used to manage the orga...
Nowadays students tend to go more for off campus placements rather than on campus placements.One of ...
C CHEATSHEETINTRODUCTION:C programming language was developed by Dennis Ritchie of Bell Labs in 1972...
What is GenC and GenC Next?GenC stands for Generation Cognizant. It basically means the fresher hiri...
C++ programming language has templates which basically allows functions and classes to work with gen...
C++ was conceived in the late 1970s to overcome the limitations of C. It is an extension of th...
Interview Questions are a great source to test your knowledge about any specific field. But remember...
The most popular high-level, multipurpose programming language right now is Python.Python supports p...
IntroductionPython is a high-level programming language with dynamic binding and high-level inherent...
Interview Questions are a great source to test your knowledge about any specific field. But remember...
Object-Oriented Programming or better known as OOPs is one of the major pillars of Java that has lev...
Java is a high-level programming language known for its robustness, object-oriented nature, enhanced...
Placements are an important part of engineering life, and while everyone hopes to be placed in a reputable company, only a few are successful. This is primarily due to a...