C Language Test 1

    Question 1Variable Declaration

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

    Question 2Relational Operators

    Which of the following statements is true in C?

    Question 3Purpose of if statement

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

    Question 4For Loop Iterations

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

    Question 5Purpose of Functions

    What is the main advantage of using functions in C?

    Question 6Array Declaration

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

    Question 7Pointer Basics

    What does a pointer variable store in C?

    Question 8Structure Basics

    What is a structure in C?

    Question 9File Pointer

    Which type is used for file pointers in C?

    Question 10String Representation

    How are strings stored in C?

    Question 11Guess 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 12Arithmetic 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 13if-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 14While Loop Condition

    Which statement about the while loop is true?

    Question 15Built-in Functions

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

    Question 16Array Indexing

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

    Question 17Declaring a Pointer

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

    Question 18Structure Declaration

    Which is the correct way to declare a structure?

    Question 19fopen() Function

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

    Question 20String Initialization

    Which of the following correctly declares and initializes a string?