Q 1 - What is the output of the below code snippet?

#include<stdio.h>

main() 
{
   for(1;2;3)
      printf("Hello");
}

A - Infinite loop

B - Prints “Hello” once.

C - No output

D - Compile error

Answer : A

Q 2 - What is the output of the following program?

#include<stdio.h>

main()
{
   printf("\");
}

A - \

B - \"

C - "

D - Compile error

Answer : D

Q 3 - Identify the invalid constant used in fseek() function as ‘whence’ reference.

A - SEEK_SET

B - SEEK_CUR

C - SEEK_BEG

D - SEEK_END


Answer : C

Q 4 - What is the output of the following program?

#include<stdio.h>

main()
{	
   char *s = "Hello, "
   "World!";

   printf("%s", s);
}

A - Hello, World!

B - Hello,

World!

C - Hello

D - Compile error


Answer : A

Q 5 - What is the output of the following program?

#include<stdio.h>

void main()
{
   char *s = "C++";
   
   printf("%s ", s);
   s++;
   printf("%s", s);
}

A - C++ C++

B - C++ ++

C - ++ ++

D - Compile error


Answer : B

Q 6 - How do you specify double constant 3.14 as a long double?

A - By using LD after 3.14

B - By using L after 3.14

C - By using DL after 3.14

D - By using LF after 3.14


Answer : B

Q 7 - The given below program allocates the memory, what function will you use to free the allocated memory?

#include<stdio.h>
#include<stdlib.h>

#define MAXROW 4
# define MAXCOL 5

int main ()
{
   int **p, i, j
   
   p = (int **) malloc(MAXROW * sizeof(int*));
   return 0;
}

A - memfree(int p);

B - free(p);

C - dealloc(p);

D - Both, free(p); & dealloc(p);


Answer : B

Q 8 - Which of the following is a logical AND operator?

A - !

B - &&

C - ||

D - &

Answer : B

Q 10 - extern int fun(); - The declaration indicates the presence of a global function defined outside the current module or in another file.

A - True

B - False

Answer : A

Q 11 - What is the output of the below code snippet?

#include<stdio.h>

main() 
{
   for(1;2;3)
      printf("Hello");
}

A - Infinite loop

B - Prints “Hello” once.

C - No output

D - Compile error

Answer : A

Q 12 - What is the output of the following program?

#include<stdio.h>

main()
{
   printf("\");
}

A - \

B - \"

C - "

D - Compile error

Answer : D

Q 13 - Identify the invalid constant used in fseek() function as ‘whence’ reference.

A - SEEK_SET

B - SEEK_CUR

C - SEEK_BEG

D - SEEK_END


Answer : C

Q 14 - What is the output of the following program?

#include<stdio.h>

main()
{	
   char *s = "Hello, "
   "World!";

   printf("%s", s);
}

A - Hello, World!

B - Hello,

World!

C - Hello

D - Compile error


Answer : A

Q 15 - What is the output of the following program?

#include<stdio.h>

void main()
{
   char *s = "C++";
   
   printf("%s ", s);
   s++;
   printf("%s", s);
}

A - C++ C++

B - C++ ++

C - ++ ++

D - Compile error

Answer : B

Q 16 - How do you specify double constant 3.14 as a long double?

A - By using LD after 3.14

B - By using L after 3.14

C - By using DL after 3.14

D - By using LF after 3.14


Answer : B

Q 17 - The given below program allocates the memory, what function will you use to free the allocated memory?

#include<stdio.h>
#include<stdlib.h>

#define MAXROW 4
# define MAXCOL 5

int main ()
{
   int **p, i, j
   
   p = (int **) malloc(MAXROW * sizeof(int*));
   return 0;
}

A - memfree(int p);

B - free(p);

C - dealloc(p);

D - Both, free(p); & dealloc(p);

Answer : B

Q 18 - Which of the following is a logical AND operator?

A - !

B - &&

C - ||

D - &

Answer : B

Q 20 - extern int fun(); - The declaration indicates the presence of a global function defined outside the current module or in another file.

A - True

B - False


Answer : A