Why our notes

Built for Fast, Smart Revision

Everything is designed to save your time and lift your score.

✂️

Zero Fluff Summaries

Only exam-relevant points in short, crisp lines, so every minute of study counts.

🗺️

Flowcharts & Visual Timelines

Mind maps, flowcharts and timelines turn heavy topics into pictures you remember.

🎯

PYQ-Linked Key Points

Key points are linked to previous-year question trends so you know what matters most.

📱

Accessible on All Devices

Read on phone, tablet or laptop, or print a clean copy with the print-friendly layout.

Free Study Articles & Updates

Top 20 Basic C Programming VIVA Questions and Answers

 Top 20 Basic C Programming VIVA  Questions and Answers

Top 20 Basic C Programming VIVA  Questions and Answers


🌐 Dive into the Heart of C Programming: Uncover the Top 20 Basic VIVA Questions and Expert Answers! 💡

Prepare to showcase your C programming prowess with our curated list of the Top 20 Basic C Programming VIVA Questions and Answers. Whether you're a student gearing up for exams or a professional looking to refresh your knowledge, this comprehensive guide is tailored to enhance your understanding and boost your confidence during VIVA sessions.


Questions

  1. What is the purpose of the register keyword in C?

    • The register keyword suggests to the compiler that a variable is likely to be heavily used and should be stored in a CPU register if possible. However, modern compilers often optimize this automatically, making the use of register less impactful.

  2. Explain the concept of typecasting in C.

    • Typecasting involves converting a variable from one data type to another. For example, (float) 5 performs typecasting to a float.

  3. What is the role of the const keyword in a function parameter list?

    • In a function parameter list, the const keyword is used to indicate that the parameter is treated as a constant and cannot be modified within the function.

  4. Discuss the purpose of the #ifdef and #ifndef directives in C.

    • #ifdef checks if a macro is defined, while #ifndef checks if a macro is not defined. They are commonly used for conditional compilation.

  5. What is the purpose of the enum keyword in C?

    • The enum keyword is used to define an enumeration type, which represents a set of named integer constants.

  6. Explain the difference between local and global static variables.

    • Local static variables are declared inside a function and retain their values between function calls. Global static variables are declared outside any function and are visible only within the file they are declared in.

  7. How do you define a macro in C using the #define directive?

    • A macro is defined using the #define directive, like this: #define MAX_SIZE 100.

  8. What is the purpose of the sizeof operator when used with a data type?

    • The sizeof operator returns the size, in bytes, of a data type. For example, sizeof(int) returns the size of an integer.

  9. How can you check if a number is odd or even in C without using the modulo operator?

    • You can use the bitwise AND operator: if (num & 1) { /* odd */ } else { /* even */ }.

  10. What is a function pointer, and how is it used in C?

    • A function pointer is a variable that stores the address of a function. It can be used to call functions dynamically at runtime.

  11. Explain the purpose of the restrict keyword in C.

    • The restrict keyword is a hint to the compiler that a pointer is the only reference to the data it points to, which can enable optimizations.

  12. How do you dynamically allocate a 2D array in C using pointers?

    • You can use a pointer to a pointer (int**) and dynamic memory allocation functions (malloc, calloc) to create a dynamic 2D array.

  13. Discuss the role of the offsetof macro in C.

    • The offsetof macro is used to find the offset of a member within a structure.

  14. What is a union, and how is it different from a structure?

    • A union is a data structure that allows different data types to be stored in the same memory location. Unlike structures, where each member has its own memory location, union members share the same memory.

  15. Explain the purpose of the volatile keyword in C.

    • The volatile keyword is used to indicate that a variable's value may change at any time outside the program's control, preventing certain compiler optimizations.

  16. What is the purpose of the inline keyword in C?

    • The inline keyword suggests to the compiler that it should attempt to integrate the function's code directly into the calling code rather than performing a traditional function call.

  17. Discuss the use of the __FILE__ and __LINE__ macros in C.

    • __FILE__ is a predefined macro that expands to the current source file name, and __LINE__ expands to the current line number.

  18. Explain the purpose of the EXIT_SUCCESS and EXIT_FAILURE macros.

    • These macros are used as exit codes in C programs. EXIT_SUCCESS typically represents a successful program execution, and EXIT_FAILURE represents a failure.

  19. What is the purpose of the assert macro in C?

    • The assert macro is used for debugging purposes. It tests an expression and, if false, prints a diagnostic message and terminates the program.

  20. Discuss the concept of a pointer to a function in C.

    • A pointer to a function stores the memory address of a function. It allows for dynamic function calls and is commonly used in scenarios like callbacks and function arrays.
✍

Thanks for reading. Share this with a friend who is preparing too.

Comments

Want the complete course?Get full notes, tests and expert support.Browse Premium Courses
Simple & easy

How It Works

Get your notes in three easy steps.

1

Pick your exam

Choose UPSC, SSC, Banking, Railways, State PSC or Defence and find the subject you need.

2

Preview a free sample

Flip through sample pages with Quick Look before you decide to buy.

3

Buy and download the PDF

Pay securely and download your notes to read or print on any device.

FAQ

Frequently Asked Questions

How do I download the notes after buying?

After your payment is complete you receive a download link for the PDF. Open it on any device and save the file for offline reading.

Can I print the PDF notes?

Yes. The notes use a print-friendly layout with clean margins, so you can print the pages you need or the full notes.

How often are the notes updated?

Notes are reviewed for each exam cycle and pattern change. The latest status is shown on every product card, for example Updated Pattern.

Can I see a sample before I buy?

Yes. Every notes pack has a free sample. Click Free Sample (PDF) or Quick Look to flip through sample pages before you pay.

Which devices can I use to read the notes?

The notes are PDF files that open on mobiles, tablets, laptops and desktops with any free PDF reader.

Are the notes available in Hindi and English?

The language of each pack is shown on its card. Use the search box to find notes in the language you prefer.