Syntax in C MCQs Exercise I

Ques 1 Syntax


Which Compiler used in c programming?

A GNU C/C++ Compiler
B DDD Compiler
C NPU C/C++ Compiler
D All of these

Ques 2 Syntax


Which of the following is the correct syntax of header file declaration?

A #INCLUDE.STDIO.H
B #include.stdio.h
C #include
D include

Ques 3 Syntax


Which of the following is the correct syntax of variable declaration?

A int x;
B int @a;
C int vik@s ;
D Both a and c

Ques 4 Syntax


Which of the following is the correct syntax to allocate memory dynamically in C?

A int *ptr = malloc(sizeof(int));
B int ptr = malloc(sizeof(int));
C int ptr = malloc(int);
D int *ptr = malloc(int);

Ques 5 Syntax


What is the correct syntax to include a header file in C?

A #include "file.h"
B include <file.h>
C include "file.h"
D include <file>

Option (a) #include "file.h" is the correct syntax to include a header file in C, especially when it's a user-defined file. This syntax tells the preprocessor to look for the file in the same directory as the source file or in the directories specified by the project.