C

Skill
Programming Language

Top 150 C Interview Questions and Answers 2024

157 questions found

Updated 12 Dec 2024

Q1. Why the default value of reg keyword is garbage value only

Ans.

The default value of reg keyword is garbage value due to performance optimization.

  • Garbage value is faster to assign than initializing to a specific value.

  • Initializing to a specific value would require additional instructions and memory access.

  • The value of reg keyword is expected to be overwritten before use.

  • Garbage value can help in detecting uninitialized variables during testing.

  • Example: int x; // x will have a garbage value until assigned a value.

Add your answer
Frequently asked in

Q2. Can you tell me the difference between C and C++ ?

Ans.

C is a procedural programming language while C++ is an extension of C with added features of object-oriented programming.

  • C is a procedural language, while C++ supports both procedural and object-oriented programming.

  • C++ has additional features like classes, objects, inheritance, and polymorphism.

  • C++ supports function overloading and exception handling, which are not present in C.

  • C++ has a standard template library (STL) that provides useful data structures and algorithms.

  • C++ ...read more

Add your answer
Frequently asked in

Q3. Write a short code in java or C

Ans.

Code to find the factorial of a number

  • Use a loop to multiply the number with all the numbers below it

  • Handle the case when the number is 0 or 1 separately

  • Use long data type to handle large factorials

View 1 answer
Frequently asked in

Q4. Difference between c programming and python

Ans.

C is a compiled language with low-level memory manipulation, while Python is an interpreted language with high-level abstractions.

  • C is faster and more efficient for low-level programming, while Python is easier to learn and use for high-level tasks.

  • C requires manual memory management, while Python has automatic garbage collection.

  • C is statically typed, while Python is dynamically typed.

  • C is used for system programming, embedded systems, and game development, while Python is u...read more

Add your answer
Are these interview questions helpful?

Q5. diff b/w c and embedded c

Ans.

Embedded C is a subset of the C programming language, specifically designed for programming embedded systems.

  • Embedded C is optimized for resource-constrained systems with limited memory and processing power.

  • It includes additional keywords and features for controlling hardware directly.

  • Embedded C often involves working with microcontrollers, sensors, and other hardware components.

  • Regular C can be used for general-purpose programming on desktop or server systems.

View 1 answer
Frequently asked in

Q6. difference between calloc and malloc function

Ans.

calloc initializes the allocated memory to zero, while malloc does not.

  • calloc allocates memory for an array of elements and initializes them to zero, while malloc only allocates memory without initialization.

  • calloc is useful for initializing arrays of integers or structures, while malloc is more flexible for allocating memory for any data type.

  • Example: int *arr = (int*)calloc(5, sizeof(int)); // initializes array of 5 integers to zero

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q7. Draw the flow chart for the following C program

Ans.

Flow chart for a C program

  • Identify the input and output

  • Determine the conditions and loops

  • Draw the flow chart accordingly

Add your answer
Frequently asked in

Q8. How can we Do Web development using C

Ans.

Web development using C involves using frameworks like CGI, FastCGI, or libraries like libmicrohttpd.

  • Use frameworks like CGI or FastCGI to handle HTTP requests and responses.

  • Utilize libraries like libmicrohttpd for creating web servers in C.

  • Implement server-side logic in C to generate dynamic web content.

  • Use HTML and CSS for front-end development alongside C for back-end logic.

Add your answer

C Jobs

C2C Credit Management Process Expert - C 4-7 years
Capgemini Technology Services India Limited
3.8
Tiruchirappalli
Portuguese Language Expert(C1/C2 Certification/MA Portuguese) 2-7 years
Oracle
3.7
Bangalore / Bengaluru
Senior Associate-Contract & Compliance_Regulatory - C&C_ TRS 2-7 years
Pricewaterhouse Coopers Private Limited
3.4
₹ 8 L/yr - ₹ 33 L/yr
(AmbitionBox estimate)
Gurgaon / Gurugram

Q9. What is c and what is routing

Ans.

C is a programming language and routing is the process of selecting the best path for network traffic.

  • C is a high-level programming language used for system programming and developing applications.

  • Routing is the process of selecting the best path for network traffic to reach its destination.

  • Routing protocols like OSPF, BGP, and EIGRP are used to determine the best path for network traffic.

  • Routing tables are used to store information about network topology and available paths....read more

Add your answer

Q10. What is knowledge of c and object oriented language

Ans.

Knowledge of C and object-oriented languages is essential for software application developers.

  • C is a procedural programming language commonly used for system programming and embedded systems.

  • Object-oriented languages like Java, C++, and Python allow for the creation of reusable code through the use of classes and objects.

  • Understanding concepts like inheritance, polymorphism, and encapsulation is crucial in object-oriented programming.

  • Proficiency in C and object-oriented langu...read more

Add your answer

Q11. Which compiler we are using in c C data types

Ans.

The choice of compiler in C depends on the platform and the specific needs of the project.

  • Different platforms may have different default compilers, such as GCC on Linux and Clang on macOS.

  • Some projects may require a specific compiler for compatibility or performance reasons.

  • C compilers include GCC, Clang, Microsoft Visual C++, and Intel C++ Compiler, among others.

Add your answer
Frequently asked in

Q12. What are the differences between pascal and C?

Ans.

Pascal is a strongly typed language with built-in data types, while C is a weakly typed language with pointers and manual memory management.

  • Pascal has built-in data types, while C requires manual declaration and definition of data types

  • Pascal is strongly typed, while C is weakly typed

  • C has pointers and manual memory management, while Pascal does not

  • Pascal has a simpler syntax and is easier to learn, while C is more complex and powerful

  • C is widely used in systems programming, ...read more

Add your answer
Frequently asked in

Q13. WHAT IS C AND WHAT DO YOU MEAN BY PROCEDURAL PROGRAMMING LANGUAGES

Ans.

C is a high-level programming language known for its efficiency and flexibility. Procedural programming languages focus on procedures or routines to execute tasks.

  • C is a general-purpose programming language developed in the 1970s.

  • It is widely used for system programming, embedded systems, and applications.

  • Procedural programming languages like C focus on procedures or routines to execute tasks step by step.

  • Examples of procedural programming languages include C, Pascal, and For...read more

Add your answer

Q14. C - What does keyword Static do?

Ans.

The keyword Static is used to declare a variable or method that belongs to the class and not to the instance of the class.

  • Static variables are shared by all instances of the class.

  • Static methods can be called without creating an instance of the class.

  • Static variables and methods are accessed using the class name instead of the instance name.

  • Static variables are initialized only once, at the start of the program.

  • Examples of static methods include Math.max() and Arrays.sort().

Add your answer
Frequently asked in

Q15. Structures in C

Ans.

Structures in C are user-defined data types that allow for grouping different data types under a single name.

  • Structures can contain variables of different data types, allowing for more complex data organization.

  • They are defined using the 'struct' keyword.

  • Example: struct Person { char name[50]; int age; float salary; };

  • Individual members of a structure can be accessed using the dot operator (.)

  • Example: struct Person p1; p1.age = 30;

Add your answer

Q16. Bitwise operations in C

Ans.

Bitwise operations in C are used to manipulate individual bits of data in variables.

  • Bitwise AND (&) - sets a bit to 1 only if both corresponding bits are 1

  • Bitwise OR (|) - sets a bit to 1 if either of the corresponding bits is 1

  • Bitwise XOR (^) - sets a bit to 1 if the corresponding bits are different

  • Bitwise NOT (~) - inverts all the bits in a variable

  • Left shift (<<) - shifts the bits to the left by a specified number of positions

  • Right shift (>>) - shifts the bits to the right...read more

Add your answer

Q17. Process of gcc compilerfor c files

Ans.

The gcc compiler processes C files by preprocessing, compiling, assembling, and linking.

  • Preprocessing: Removes comments, expands macros, and includes header files.

  • Compiling: Translates source code into assembly code.

  • Assembling: Converts assembly code into machine code.

  • Linking: Combines object files and libraries into an executable.

Add your answer

Q18. 1 Wap print even num in python/ C 2 Wap print Fibonacci series num in python

Ans.

Print even numbers in Python and Fibonacci series in Python.

  • For printing even numbers in Python, use a loop to iterate through a range of numbers and check if each number is divisible by 2.

  • For printing Fibonacci series in Python, use a loop to generate the series by adding the previous two numbers in the sequence.

  • Example for even numbers in Python: for i in range(1, 11): if i % 2 == 0: print(i)

  • Example for Fibonacci series in Python: a, b = 0, 1 for _ in range(10): print(a) a,...read more

Add your answer

Q19. How are unions used

Ans.

Unions are used to combine multiple variables of different data types into a single variable.

  • Unions allow for efficient use of memory by sharing the same memory location for different variables.

  • They are commonly used in low-level programming for hardware access and data serialization.

  • An example of a union is a struct that contains a float and an integer, where changing the value of one will affect the other.

Add your answer

Q20. What is Difference between C,C++?

Ans.

C is a procedural programming language while C++ is an object-oriented programming language.

  • C is a low-level language while C++ is a high-level language.

  • C++ supports object-oriented programming concepts like classes, inheritance, and polymorphism.

  • C++ has better support for exception handling and templates.

  • C++ is more complex than C and requires more memory.

  • C++ is used for developing applications like video games, while C is used for developing operating systems and system sof...read more

Add your answer
Frequently asked in

Q21. Differnence between C and Java

Ans.

C is a procedural programming language while Java is an object-oriented programming language.

  • C is a low-level language while Java is a high-level language.

  • C requires manual memory management while Java has automatic memory management.

  • C supports pointers while Java does not.

  • C is platform-dependent while Java is platform-independent.

  • C has a simpler syntax compared to Java.

Add your answer
Frequently asked in

Q22. Write a code in python and C

Ans.

Code snippets in Python and C for System Engineer interview question

  • Use Python for high-level scripting and C for low-level system programming

  • Python example: ```python print('Hello, World!') ```

  • C example: ```c #include int main() { printf('Hello, World!'); return 0; } ```

Add your answer
Frequently asked in

Q23. What is embedded c and how is it different from normal c

Ans.

Embedded C is a variant of C programming language used for programming embedded systems.

  • Embedded C is used for programming microcontrollers, sensors, and other embedded systems.

  • It has limited resources and memory, so it requires efficient coding.

  • It has specific libraries and functions for hardware control.

  • Normal C is used for general-purpose programming and has no specific hardware dependencies.

  • Embedded C is compiled using a cross-compiler, while normal C is compiled using a ...read more

Add your answer
Frequently asked in

Q24. What is calloc ,malloc

Ans.

calloc and malloc are functions used in C programming to allocate memory dynamically.

  • calloc is used to allocate and initialize a block of memory, setting all bytes to zero.

  • malloc is used to allocate a block of memory without initializing its contents.

  • Both functions return a pointer to the allocated memory, or NULL if the allocation fails.

Add your answer
Frequently asked in

Q25. C language what is c data types

Ans.

C data types are used to define the type of data that a variable can hold in C programming language.

  • C data types include basic types like int, char, float, double, etc.

  • Derived types like arrays, pointers, structures, and unions are also part of C data types.

  • Examples: int num = 10; char letter = 'A'; float price = 10.5;

  • Examples: int arr[5]; int *ptr; struct student { char name[20]; int age; };

Add your answer

Q26. Data structures through c language

Ans.

Data structures in C language are essential for organizing and manipulating data efficiently.

  • Data structures like arrays, linked lists, stacks, queues, trees, and graphs are commonly used in C programming.

  • Arrays are used to store a collection of elements of the same data type.

  • Linked lists are used to store elements in a linear order.

  • Stacks and queues are used for storing elements in a last-in-first-out (LIFO) and first-in-first-out (FIFO) manner, respectively.

  • Trees and graphs...read more

Add your answer

Q27. What is features of the C programming language.

Ans.

C is a procedural programming language known for its efficiency and low-level memory manipulation capabilities.

  • C is a compiled language

  • It has a small set of keywords and operators

  • It supports pointers and low-level memory manipulation

  • It has a preprocessor for macro expansion

  • It has a standard library with functions for common tasks

  • Examples: printf() for output, scanf() for input, malloc() for memory allocation

Add your answer
Frequently asked in

Q28. Diffreence between C and c++

Ans.

C is a procedural programming language while C++ is an extension of C with added features of object-oriented programming.

  • C is a procedural language, meaning it follows a step-by-step approach to solve a problem.

  • C++ is an extension of C and supports both procedural and object-oriented programming paradigms.

  • C++ introduces classes, objects, inheritance, and polymorphism, which are not present in C.

  • C++ has additional features like exception handling, templates, and namespaces.

  • C++...read more

Add your answer
Frequently asked in

Q29. Diff between C and Java?

Ans.

C is a procedural language while Java is an object-oriented language.

  • C is compiled while Java is interpreted

  • C has pointers while Java does not

  • Java has automatic garbage collection while C does not

  • Java has platform independence while C does not

  • Java has built-in exception handling while C does not

Add your answer

Q30. Write a coding in both python &amp; C

Ans.

Write a coding in both python & C

  • Use a simple program like printing 'Hello, World!'

  • Ensure syntax and formatting are correct in both languages

  • Test the code in both Python and C environments

Add your answer
Frequently asked in

Q31. Difference between C and Embedded C language

Ans.

Embedded C is a subset of C language specifically designed for embedded systems programming.

  • Embedded C is optimized for resource-constrained systems with limited memory and processing power.

  • Embedded C may have specific compiler directives and keywords for hardware manipulation.

  • Embedded C may not support all standard C libraries and features.

  • Example: Using 'volatile' keyword for memory-mapped hardware registers in Embedded C.

Add your answer
Frequently asked in

Q32. Write a program logic factorial in c programming

Ans.

Program logic for factorial in C programming

  • Use a loop to multiply the number with all the numbers less than it

  • Initialize the result variable with 1

  • Handle the case when the input is 0 or 1 separately

Add your answer

Q33. 1.Difference between C and Cpp

Ans.

C is a procedural language while C++ is an object-oriented language.

  • C does not support classes and objects while C++ does.

  • C++ supports function overloading while C does not.

  • C++ has a built-in exception handling mechanism while C does not.

  • C++ supports namespaces while C does not.

  • C++ supports references while C does not.

Add your answer

Q34. Rate yourself in C and Java?

Ans.

I rate myself 8/10 in C and 9/10 in Java.

  • Strong understanding of data structures and algorithms

  • Experience in developing applications using both languages

  • Familiarity with debugging and troubleshooting

  • Regularly update my knowledge through online resources and courses

Add your answer

Q35. Why is python better than C

Ans.

Python is better than C due to its simplicity, readability, and versatility.

  • Python is easier to learn and use compared to C, making it more beginner-friendly.

  • Python code is more readable and concise, leading to faster development and easier maintenance.

  • Python has a wide range of libraries and frameworks for various applications, while C is more low-level and requires more manual memory management.

Add your answer

Q36. What is c code in java

Ans.

C code in Java refers to the use of the Java Native Interface (JNI) to incorporate C code into Java programs.

  • C code in Java is typically used when performance optimization or low-level system access is required.

  • JNI allows Java programs to call C functions and use C libraries.

  • C code can be written separately and compiled into a shared library, which is then loaded and used by Java code.

  • JNI provides a way to pass data between Java and C, handle exceptions, and manage memory.

  • Exa...read more

View 1 answer
Frequently asked in

Q37. What is the difference between c and c++

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports object-oriented programming while C does not.

  • C++ has a richer set of libraries compared to C.

  • C++ allows function overloading while C does not.

  • C++ supports exception handling while C does not.

  • C++ has a more complex syntax compared to C.

  • C++ is backward compatible with C.

  • C++ has a built-in string class while C does not.

Add your answer
Frequently asked in

Q38. How would you rate yourself in C and Java?

Ans.

I would rate myself as proficient in both C and Java.

  • I have extensive experience in both languages, having worked on multiple projects using them.

  • I am comfortable with the syntax and can write efficient and optimized code.

  • I am familiar with the standard libraries and can use them effectively.

  • I am always learning and improving my skills in both languages.

  • For example, in C, I have worked on projects involving embedded systems and low-level programming, while in Java, I have dev...read more

Add your answer

Q39. Examples of c python

Ans.

C Python is a C extension module that allows C code to call Python functions and manipulate Python objects.

  • Cython is a popular tool for writing C extensions for Python

  • NumPy is a Python library that provides support for large, multi-dimensional arrays and matrices

  • Pygame is a set of Python modules designed for writing video games

  • Scikit-learn is a Python library for machine learning built on top of NumPy and SciPy

Add your answer
Frequently asked in

Q40. What is Little endian and Big endian in C

Ans.

Little endian and Big endian are byte ordering formats in which multi-byte data is stored in memory.

  • Little endian: Least significant byte is stored at the lowest memory address.

  • Big endian: Most significant byte is stored at the lowest memory address.

  • Example: In Little endian, the number 0x12345678 is stored as 78 56 34 12 in memory.

  • Example: In Big endian, the same number is stored as 12 34 56 78 in memory.

Add your answer

Q41. What are the differences in c and c++?

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has better support for function overloading and templates.

  • C++ has a standard library that includes many useful functions.

  • C++ allows for both procedural and object-oriented programming.

  • C++ is generally considered to be more complex than C.

Add your answer
Frequently asked in

Q42. Difference between Java and C language.

Ans.

Java is an object-oriented programming language while C is a procedural programming language.

  • Java is platform-independent while C is platform-dependent.

  • Java has automatic memory management while C requires manual memory management.

  • Java has built-in support for multithreading while C requires external libraries for multithreading.

  • Java has a larger standard library compared to C.

  • Java is used for developing web applications, mobile applications, and enterprise software while C i...read more

View 1 answer

Q43. what are the storage class in c

Ans.

Storage classes in C define the scope and lifetime of variables.

  • Auto: default storage class for local variables

  • Register: stores variables in CPU registers for faster access

  • Static: retains value between function calls

  • Extern: allows variables to be accessed across multiple files

Add your answer

Q44. why to c over cpp

Ans.

C is preferred over C++ for certain applications due to its simplicity and efficiency.

  • C is a simpler language compared to C++ and has a smaller runtime footprint.

  • C is often used for low-level programming, embedded systems, and operating systems.

  • C allows for more control over memory management and can be faster in certain scenarios.

  • C++ introduces additional features like object-oriented programming and templates, which may not be necessary for all projects.

Add your answer
Frequently asked in

Q45. What is c language, what is java

Ans.

C language is a procedural programming language, while Java is an object-oriented programming language.

  • C language is low-level and provides direct access to memory, making it efficient for system programming.

  • Java is platform-independent and has a rich set of libraries, making it suitable for developing applications.

  • C language uses pointers extensively, while Java handles memory management automatically with garbage collection.

  • C language is widely used for operating systems, e...read more

View 1 answer

Q46. What is storage class in C class?

Ans.

A storage class in C defines the scope and lifetime of variables.

  • Storage classes include auto, register, static, and extern.

  • Auto variables are stored in the stack and have local scope.

  • Register variables are stored in CPU registers for faster access.

  • Static variables retain their value between function calls.

  • Extern variables are declared in one file and can be used in another file.

Add your answer

Q47. What is the difference between c and c++

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has better support for function overloading and templates.

  • C++ has a more complex syntax compared to C.

  • C++ has a standard library that includes many useful functions.

  • C++ is generally considered to be a more powerful language than C.

Add your answer
Frequently asked in

Q48. What is the different between java and c

Ans.

Java and C are both programming languages, but differ in syntax, usage, and platform compatibility.

  • Java is an object-oriented language, while C is a procedural language.

  • Java is platform-independent, while C is platform-dependent.

  • Java has automatic memory management, while C requires manual memory management.

  • Java has a larger standard library than C.

  • C is faster and more efficient than Java for certain tasks, such as system programming.

  • Java is commonly used for web development,...read more

Add your answer
Frequently asked in

Q49. what is array in c

Ans.

An array in C is a collection of elements of the same data type stored in contiguous memory locations.

  • Arrays are declared by specifying the data type of the elements and the number of elements in square brackets, e.g. int arr[5];

  • Elements in an array can be accessed using their index, starting from 0, e.g. arr[0] refers to the first element.

  • Arrays in C are zero-indexed, meaning the first element is at index 0.

  • Arrays can be of any data type, including arrays of strings like cha...read more

Add your answer

Q50. What is the differnce between c and c++?

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has better support for polymorphism and inheritance.

  • C++ has a standard template library (STL) for data structures and algorithms.

  • C++ allows function overloading while C does not.

  • C++ has exception handling while C does not.

Add your answer
Frequently asked in

Q51. What is better java or c?

Ans.

Both Java and C have their own strengths and weaknesses, and the choice depends on the specific requirements of the project.

  • Java is better for developing enterprise-level applications due to its platform independence and robustness.

  • C is better for developing system-level software and applications that require high performance and low-level access to hardware.

  • Java has a larger community and more libraries and frameworks available, making it easier to find solutions to common p...read more

Add your answer
Frequently asked in

Q52. Give examples of each data types in C

Ans.

Examples of data types in C include int, float, char, and double.

  • int: used for storing integer values (e.g. age = 25)

  • float: used for storing floating-point numbers (e.g. height = 5.8)

  • char: used for storing single characters (e.g. grade = 'A')

  • double: used for storing double-precision floating-point numbers (e.g. salary = 50000.50)

Add your answer
Frequently asked in

Q53. Why is c++ better than C?

Ans.

C++ is better than C due to its object-oriented programming features and better memory management.

  • C++ supports object-oriented programming while C does not.

  • C++ has better memory management with features like constructors and destructors.

  • C++ has more advanced features like templates and exceptions.

  • C++ is more versatile and can be used for both low-level system programming and high-level application development.

  • C++ has a larger standard library compared to C.

  • C++ allows for func...read more

Add your answer

Q54. Different between c and java

Ans.

C is a procedural language while Java is an object-oriented language.

  • C is compiled while Java is interpreted

  • Java has automatic garbage collection while C requires manual memory management

  • Java has platform independence while C is platform dependent

  • Java has built-in exception handling while C does not

  • Java has a larger standard library than C

Add your answer
Frequently asked in

Q55. count the number of occurences in program in c .

Ans.

Use a loop to iterate through the array and count the occurrences of a specific element.

  • Initialize a counter variable to keep track of the occurrences.

  • Use a loop to iterate through the array.

  • Check each element in the array and increment the counter if it matches the specific element.

  • Return the final count of occurrences.

Add your answer

Q56. Differance between c and c++

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has better support for function overloading and templates.

  • C++ has a standard library that includes many useful functions.

  • C++ is more complex than C and can be harder to learn.

  • C++ code can be compiled as C code with some modifications.

Add your answer
Frequently asked in

Q57. What is java and difference between java and c

Ans.

Java is a high-level programming language used for developing applications. Java is platform-independent and object-oriented.

  • Java is compiled and interpreted while C is only compiled

  • Java is platform-independent while C is platform-dependent

  • Java is object-oriented while C is procedural

  • Java has automatic garbage collection while C does not

  • Java has a larger standard library compared to C

Add your answer

Q58. Write a C code to swap two numbers without using 3rd variable

Ans.

Swapping two numbers without using a third variable in C code.

  • Use bitwise XOR operation to swap two numbers without using a third variable.

  • Example: int a = 5, b = 10; a = a ^ b; b = a ^ b; a = a ^ b; // Now a = 10, b = 5

Add your answer

Q59. State the differences between C and C++.

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has constructors and destructors while C does not.

  • C++ supports function overloading while C does not.

  • C++ has namespaces while C does not.

  • C++ supports exception handling while C does not.

Add your answer
Frequently asked in

Q60. what is java and how is it different from c?

Ans.

Java is a high-level programming language known for its platform independence, while C is a low-level programming language with more direct hardware access.

  • Java is platform-independent, meaning code can run on any device with a Java Virtual Machine (JVM)

  • C is a low-level language with more direct hardware access, making it faster but less portable than Java

  • Java has automatic memory management through garbage collection, while C requires manual memory management

Add your answer
Frequently asked in

Q61. What is the output of a given C program

Ans.

The output of a C program depends on the code logic and input provided.

  • The output can be determined by analyzing the code and understanding the logic implemented.

  • Input values can also affect the output of the program.

  • Compile and run the program to see the actual output.

Add your answer
Frequently asked in

Q62. what is diff b/w c and c++

Ans.

C++ is an extension of C with added features like object-oriented programming, templates, and exception handling.

  • C++ supports object-oriented programming while C does not.

  • C++ has templates for generic programming while C does not.

  • C++ has exception handling while C does not.

  • C++ has a standard library that includes the C standard library.

  • C++ allows function overloading while C does not.

Add your answer
Frequently asked in

Q63. what is java and c

Ans.

Java and C are both popular programming languages used for developing software applications.

  • Java is a high-level, object-oriented programming language known for its platform independence.

  • C is a procedural programming language known for its efficiency and flexibility.

  • Java uses a virtual machine to run code, while C directly compiles to machine code.

  • Java is commonly used for web development, mobile apps, and enterprise applications.

  • C is often used for system programming, embedd...read more

Add your answer
Frequently asked in

Q64. What is malloc and calloc function

Ans.

malloc and calloc are functions in C programming used for dynamic memory allocation.

  • malloc function is used to allocate a single block of memory of a specified size.

  • calloc function is used to allocate multiple blocks of memory of a specified size, initialized to zero.

  • Example: int *ptr = (int*)malloc(5 * sizeof(int));

  • Example: int *ptr = (int*)calloc(5, sizeof(int));

Add your answer
Frequently asked in

Q65. What is c,what is cpp and so on.

Ans.

C and C++ are programming languages used for system programming and application development.

  • C is a procedural programming language developed by Dennis Ritchie in 1972.

  • C++ is an object-oriented programming language developed by Bjarne Stroustrup in 1983.

  • C is used for system programming, embedded systems, and operating systems.

  • C++ is used for application development, game development, and system programming.

  • C++ is an extension of C with additional features like classes, inherit...read more

Add your answer
Frequently asked in

Q66. Whay is different between c and java

Ans.

C is a procedural programming language while Java is an object-oriented programming language.

  • C is a procedural programming language, focusing on functions and procedures.

  • Java is an object-oriented programming language, focusing on classes and objects.

  • C requires manual memory management, while Java has automatic garbage collection.

  • C is platform-dependent, while Java is platform-independent due to its bytecode compilation.

  • C supports pointers, while Java does not.

  • C has a simpler...read more

Add your answer
Frequently asked in

Q67. what is struct and unions

Ans.

Structs and unions are data structures in C programming used to group different data types under a single name.

  • Structs allow you to group different data types together under a single name. For example, a struct 'Person' can have fields like name, age, and gender.

  • Unions are similar to structs but they share the same memory location for all its members. Only one member can contain a value at a time. For example, a union 'Data' can have fields like int, float, and char, but only...read more

Add your answer
Frequently asked in

Q68. What is c? What is c++?

Ans.

C and C++ are programming languages used for system and application software development.

  • C is a procedural programming language developed by Dennis Ritchie in 1972.

  • C++ is an object-oriented programming language developed by Bjarne Stroustrup in 1983.

  • C is used for developing system software, device drivers, and embedded systems.

  • C++ is used for developing application software, games, and operating systems.

  • C++ is an extension of C with additional features like classes, inheritan...read more

Add your answer

Q69. What is difference between Java and C, explain features of java

Ans.

Java is a high-level programming language, while C is a low-level language. Java is platform-independent and has automatic memory management.

  • Java is an object-oriented language, while C is a procedural language.

  • Java uses a virtual machine (JVM) for execution, while C directly compiles to machine code.

  • Java has built-in garbage collection, while C requires manual memory management.

  • Java supports multithreading and exception handling, while C has limited support for these feature...read more

Add your answer
Frequently asked in

Q70. stack variable is present in which segment

Ans.

Stack variable is present in the stack segment of memory.

  • Stack variables are local variables declared inside a function and are stored in the stack segment of memory.

  • Stack memory is used for function calls and local variables, and is managed in a Last In First Out (LIFO) manner.

  • Example: int x; is a stack variable declared inside a function.

Add your answer

Q71. Differences between C and C++

Ans.

C is a procedural programming language while C++ is an extension of C with object-oriented programming features.

  • C is a procedural language while C++ supports both procedural and object-oriented programming.

  • C does not have built-in support for classes and objects, while C++ does.

  • C++ supports features like inheritance, polymorphism, and encapsulation which are not available in C.

  • C++ has a standard template library (STL) which provides useful data structures and algorithms.

  • C++ a...read more

Add your answer
Frequently asked in

Q72. what is c and java

Ans.

C and Java are both programming languages commonly used for software development.

  • C is a procedural programming language developed by Dennis Ritchie in 1972.

  • Java is an object-oriented programming language developed by Sun Microsystems in 1995.

  • C is often used for system programming and low-level programming.

  • Java is platform-independent and commonly used for web development.

  • C requires manual memory management, while Java has automatic garbage collection.

Add your answer
Frequently asked in

Q73. What are data types in c language

Ans.

Data types in C language define the type of data that a variable can store.

  • Basic data types include int, float, char, double, etc.

  • Derived data types include arrays, pointers, structures, unions, etc.

  • Example: int num = 10; char letter = 'A'; float value = 3.14;

Add your answer
Frequently asked in

Q74. What is c language and c++ language deference

Ans.

C is a procedural programming language while C++ is an object-oriented programming language.

  • C is a low-level language while C++ is a high-level language.

  • C does not support classes and objects while C++ does.

  • C++ supports function overloading and operator overloading while C does not.

  • C++ has better support for exception handling than C.

  • C++ is an extension of C language.

Add your answer
Frequently asked in

Q75. What are your skills? C language and java

Ans.

Proficient in C language and Java programming with experience in developing software applications.

  • Strong understanding of data structures and algorithms in C language

  • Experience in developing web applications using Java

  • Knowledge of object-oriented programming principles in Java

  • Familiarity with Java frameworks like Spring and Hibernate

Add your answer
Frequently asked in

Q76. Explain storage variables in C?

Ans.

Storage variables in C are used to store data temporarily during program execution.

  • Storage variables in C are declared using data types like int, float, char, etc.

  • They can be stored in different memory locations like stack, heap, or data segment.

  • Variables declared outside functions have global scope and are stored in data segment.

  • Variables declared inside functions have local scope and are stored in stack memory.

  • Dynamic memory allocation using functions like malloc() stores v...read more

Add your answer

Q77. diff bt c and c++? ---told

Ans.

C is a procedural programming language while C++ is an extension of C with added features of object-oriented programming.

  • C is a procedural language, meaning it follows a step-by-step approach to solve a problem.

  • C++ is an extension of C and supports both procedural and object-oriented programming paradigms.

  • C++ introduces features like classes, objects, inheritance, and polymorphism that are not present in C.

  • C++ allows for the use of libraries and frameworks developed in C, mak...read more

Add your answer
Frequently asked in

Q78. What is the difference of c and java?

Ans.

C is a procedural programming language while Java is an object-oriented programming language.

  • C is a low-level language, closer to the hardware, while Java is a high-level language.

  • C requires manual memory management, while Java has automatic garbage collection.

  • C is platform-dependent, while Java is platform-independent due to its bytecode.

  • C uses pointers extensively, while Java does not have pointers.

  • C is used for system programming, embedded systems, etc., while Java is used...read more

Add your answer
Frequently asked in

Q79. Why C is called middle level language?

Ans.

C is called middle level language because it combines features of both high-level and low-level languages.

  • C allows low-level manipulation like memory management and bit manipulation.

  • C also supports high-level features like functions, data structures, and dynamic memory allocation.

  • C is closer to the hardware compared to high-level languages like Java or Python, but not as close as low-level languages like assembly.

  • C provides a good balance between performance and flexibility.

Add your answer
Frequently asked in

Q80. What is tha different between cand c++

Ans.

C++ is an extension of C language with object-oriented programming features.

  • C++ supports object-oriented programming while C does not.

  • C++ has more advanced features like templates, exceptions, and namespaces.

  • C++ is more complex and harder to learn than C.

  • C++ is used for developing system software, games, and applications.

  • C is used for developing operating systems, embedded systems, and device drivers.

Add your answer
Frequently asked in

Q81. What is c? Difference between C and Java?

Ans.

C is a procedural programming language. C is faster and more efficient than Java.

  • C is a low-level language, closer to machine code.

  • C requires manual memory management, while Java has automatic garbage collection.

  • C is used for system programming, embedded systems, and operating systems.

  • Java is used for web development, mobile app development, and enterprise applications.

Add your answer
Frequently asked in

Q82. What are storage classes in c language?

Ans.

Storage classes in C language define the scope and lifetime of variables.

  • There are four storage classes in C: auto, register, static, and extern.

  • Auto variables are local to the block they are declared in and have automatic storage duration.

  • Register variables are stored in CPU registers for faster access.

  • Static variables retain their value between function calls.

  • Extern variables are declared outside of any function and can be accessed by other files.

  • Example: int x; // auto sto...read more

Add your answer

Q83. Write C code and C++ code

Ans.

Providing C and C++ code for Senior Software Engineer position

  • For C code, demonstrate knowledge of pointers, memory allocation, and basic data structures

  • For C++ code, showcase understanding of object-oriented programming, inheritance, and polymorphism

  • Provide clear and concise code with proper commenting and formatting

Add your answer

Q84. Languages known( c, java)

Ans.

I am proficient in C and Java programming languages.

  • Experience in developing applications using C and Java

  • Knowledge of data structures and algorithms

  • Familiarity with object-oriented programming concepts

  • Ability to write efficient and optimized code

  • Examples: Developed a Java-based web application for online shopping, Implemented a C program for sorting algorithms

Add your answer

Q85. Explain about the structures in c

Ans.

Structures in C are user-defined data types that allow grouping of variables of different data types under a single name.

  • Structures are used to represent a record which consists of different data types.

  • They are defined using the 'struct' keyword.

  • Each variable in a structure is called a member.

  • Structures can be nested within other structures.

  • Example: struct employee { int emp_id; char emp_name[50]; float emp_salary; };

  • Example: struct point { int x; int y; };

Add your answer

Q86. Difference b/w c and c++

Ans.

C is a procedural programming language while C++ is an object-oriented programming language.

  • C++ supports classes and objects while C does not.

  • C++ has better support for polymorphism and inheritance than C.

  • C++ has a larger standard library than C.

  • C++ allows function overloading while C does not.

  • C++ supports exception handling while C does not.

Add your answer

Q87. C and Java difference

Ans.

C is a procedural language while Java is an object-oriented language.

  • C is compiled while Java is interpreted.

  • C has pointers while Java does not.

  • Java has automatic garbage collection while C does not.

  • Java has a built-in exception handling mechanism while C does not.

  • Java has a larger standard library than C.

  • C is used for system programming while Java is used for web and mobile applications.

Add your answer
Frequently asked in

Q88. write to print string by passing char*

Ans.

Use a loop to print each character of the string passed as a char* parameter.

  • Use a for loop to iterate through each character of the char* parameter.

  • Print each character using printf or cout.

  • Ensure to handle the null terminator at the end of the string.

Add your answer

Q89. 1.Different between c and c++

Ans.

C++ is an extension of C with added features like object-oriented programming, templates, and exception handling.

  • C++ supports object-oriented programming while C does not.

  • C++ has a richer set of data types and operators than C.

  • C++ supports function overloading and templates while C does not.

  • C++ has exception handling while C does not.

  • C++ is backward compatible with C.

  • Example: C++ allows defining classes and objects while C does not.

  • Example: C++ supports function overloading, ...read more

Add your answer
Frequently asked in

Q90. tell me about functions in c

Ans.

Functions in C are blocks of code that perform a specific task and can be called multiple times within a program.

  • Functions in C are defined using a return type, function name, parameters, and a body enclosed in curly braces.

  • Functions can be called multiple times within a program to perform the same task without rewriting the code.

  • Functions can return a value using the 'return' statement.

  • Functions can also be void, meaning they do not return a value.

  • Example: int add(int a, int...read more

Add your answer
Frequently asked in

Q91. Explain about c and c++

Ans.

C and C++ are programming languages used for system programming and application development.

  • C is a procedural language while C++ is an object-oriented language.

  • C is used for system programming, embedded systems, and low-level programming.

  • C++ is used for application development, game development, and high-performance computing.

  • C++ supports features like inheritance, polymorphism, and encapsulation.

  • Both languages are compiled languages and have a similar syntax.

Add your answer
Frequently asked in

Q92. What is Pointer

Ans.

A pointer is a variable that stores the memory address of another variable.

  • Pointers are used to access and manipulate memory directly.

  • They are commonly used in programming languages like C and C++.

  • Example: int *ptr; // declares a pointer to an integer variable

Add your answer
Frequently asked in, ,

Q93. what is c c++

Ans.

C and C++ are programming languages used for system and application software development.

  • C is a procedural programming language developed by Dennis Ritchie in 1972.

  • C++ is an object-oriented programming language developed by Bjarne Stroustrup in 1983.

  • Both languages are widely used for developing operating systems, device drivers, and other system software.

  • C++ is also used for developing applications, games, and other software.

  • C++ is an extension of C and includes additional fe...read more

Add your answer

Q94. Copy one string to another without using any standard function

Ans.

Use a loop to copy characters from one string to another

  • Create two character arrays to store the strings

  • Use a loop to iterate through each character of the source string and copy it to the destination string

  • Add a null terminator at the end of the destination string to mark the end of the copied string

Add your answer
Frequently asked in

Q95. What is c++ What is c

Ans.

C++ and C are programming languages used for system and application development.

  • C++ is an object-oriented language that supports polymorphism, inheritance, and encapsulation.

  • C is a procedural language that is widely used for system programming and embedded systems.

  • Both languages are compiled and have a wide range of applications in software development.

  • C++ is often used for developing applications, games, and operating systems.

  • C is often used for developing system software, d...read more

Add your answer
Frequently asked in

Q96. write to print string in C style array

Ans.

Use a loop to print each character of the string in C style array format

  • Declare an array of characters with the string length + 1 for null terminator

  • Use a loop to copy each character of the string into the array

  • Add a null terminator at the end of the array to signify the end of the string

Add your answer

Q97. Difference between C programming and C++

Ans.

C++ is an extension of C programming language with added features like object-oriented programming and templates.

  • C++ supports object-oriented programming while C does not.

  • C++ has a richer set of libraries compared to C.

  • C++ supports function overloading while C does not.

  • C++ supports exception handling while C does not.

  • C++ supports templates while C does not.

  • C++ has a more complex syntax compared to C.

  • C++ is backward compatible with C.

  • C++ is used for developing operating system...read more

Add your answer
Frequently asked in

Q98. Detect endianness using C program

Ans.

Detect endianness using C program

  • Use a union to create a variable with a known value

  • Check the value of the first byte to determine endianness

  • Big endian systems store the most significant byte first

  • Little endian systems store the least significant byte first

  • Example: union { int i; char c; } u; u.i = 1; if (u.c == 1) { /* Little endian */ } else { /* Big endian */ }

Add your answer
Frequently asked in

Q99. 1)Difference between C and C++

Ans.

C is a procedural programming language while C++ is an extension of C with added features of object-oriented programming.

  • C is a procedural language, while C++ supports both procedural and object-oriented programming.

  • C does not have built-in support for classes and objects, while C++ does.

  • C++ supports features like inheritance, polymorphism, and encapsulation, which are not present in C.

  • C++ has a standard template library (STL) that provides useful data structures and algorith...read more

Add your answer
Frequently asked in

Q100. Explain about structures in c

Ans.

Structures in C are user-defined data types that allow you to group different variables under a single name.

  • Structures are used to represent a record.

  • They can contain variables of different data types.

  • You can access the members of a structure using the dot operator.

  • Structures are defined using the 'struct' keyword.

Add your answer
Frequently asked in
1
2
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.7
 • 5.1k Interviews
3.8
 • 4.6k Interviews
3.6
 • 3.6k Interviews
3.6
 • 3.4k Interviews
4.2
 • 383 Interviews
View all
C Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter