Variables and Data Types Interview Questions

    Question 1Variable Declaration

    What is the correct way to declare an integer variable named count in C?

    Question 2Guess the Output - Integer Division

    What will be the output of the following C code snippet?

    #include int main() { int x = 5, y = 2; printf("%d", x / y); return 0; }

    Question 3Character Data Type

    Which of the following data types is used to store a single character and occupies 1 byte of memory?

    Question 4Guess the Output - Type Mismatch

    What will be the output of the following C code snippet?

    #include <stdio.h> int main() { int num = 'C'; printf("%d", num); return 0; }

    Question 5Floating-Point Data Type

    How do you declare a variable named pi to store the value 3.14159 with high precision?

    Question 6Guess the Output - Type Promotion

    What is the output of the following code?

    #include <stdio.h> int main() { int a = 10; float b = 3.0; printf("%.2f", a / b); return 0; }

    Question 7Variable Naming Rules

    Which of the following is a valid variable name in C?

    Question 8Guess the Output - sizeof Operator

    Assuming a 32-bit system, what is the output of this code?

    #include <stdio.h> int main() { printf("%lu", sizeof(char)); return 0; }

    Question 9Data Type Modifiers

    The long data type modifier is used to:

    Question 10Guess the Output - Constant Declaration

    What is the output of the following code?

    #include <stdio.h> #define PI 3.14 int main() { printf("%f", PI * 2); return 0; }