C Programming Quizz

Start Quiz

What is the correct syntax of the main function in C?

int main() void main() int main(void) main()

Which of the following is not a valid C data type?

int float bool char

What is the size of a char data type in C?

1 byte 2 bytes 4 bytes 8 bytes

The continue statement in C is used to:

Exit a loop Skip the current iteration of a loop Break out of a loop Restart the loop

What is the output of 5 % 2 in C?

1.5 1 0 2

Which operator has the highest precedence in C?

+ = () &&

What is the correct syntax for declaring a 1-D array in C?

array[10] int array[10]; int array; int array[];

In a switch-case statement, the default keyword is:

Optional Mandatory Used for repeating cases Executed when no cases match

What will printf("%d", "A"); print in C?

65 ASCII value of A A Error

The type conversion explicitly performed by the programmer is called:

Implicit Conversion Explicit Conversion Auto Casting Dynamic Conversion

Which keyword is used to define a union in C?

struct class union object

What is the difference between struct and union?

Struct occupies less memory Union allows multiple members to share memory Struct is faster Union saves memory

How do you pass an array to a function in C?

Call by Value Call by Reference Pass by Object None of these

What will be the output of this loop: for(i=0; i<5; i++) printf("%d", i);?

1234 01234 (printed inline) 1 2 3 4 0 1 2 3

What is the purpose of a typedef in C?

Define new data type names Allocate memory Reallocate memory Assign variable

Which is a correct declaration of a character array?

char str[10] = char str[10]; char[10] = str char[10];

In recursion, a function:

Calls itself Doesn't call itself Repeats without condition Is faster than iteration

The sizeof operator in C:

Returns the size in kilobytes Counts memory spaces Returns size in bytes Gives memory type

Which storage class makes a variable retain its value between function calls?

Auto Register Static Extern

Bit-fields in structures are used to:

Align structures Save space in an array Allocate specific bits for structure members Use bitwise operators
Quiz/Test Summary
Title: C Programming Quizz
Questions: 20
Contributed by:
Bahra University NextGen Academy