C Language Test 1

    Question 1: Variable Declaration

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

    Question 2: Relational Operators

    Which of the following statements is true in C?

    Question 3: Purpose of if statement

    The primary purpose of an if statement in C programming is to:

    Question 4: For Loop Iterations

    How many times does the loop run in for (int i = 0; i < 10; i++)?

    Question 5: Purpose of Functions

    What is the main advantage of using functions in C?

    Question 6: Array Declaration

    Which of the following is the correct way to declare an integer array of size 10 in C?

    Question 7: Pointer Basics

    What does a pointer variable store in C?

    Question 8: Structure Basics

    What is a structure in C?

    Question 9: File Pointer

    Which type is used for file pointers in C?

    Question 10: String Representation

    How are strings stored in C?

    Question 11: Guess 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 12: Arithmetic Operators

    What is the output of the following C code?

    #include <stdio.h> int main() { int x = 15; int y = 4; printf("%d", x / y); return 0; }

    Question 13: if-else if vs. separate if

    What is a key difference between using a series of separate if statements and using an if-else if ladder?

    Question 14: While Loop Condition

    Which statement about the while loop is true?

    Question 15: Built-in Functions

    Which of the following is a standard library function in C?

    Question 16: Array Indexing

    If int arr[5]; is declared, what are the valid indices?

    Question 17: Declaring a Pointer

    Which of the following correctly declares a pointer to an integer?

    Question 18: Structure Declaration

    Which is the correct way to declare a structure?

    Question 19: fopen() Function

    Which is the correct syntax to open a file in C for reading?

    Question 20: String Initialization

    Which of the following correctly declares and initializes a string?