Q. Choose a correct statement about a Multidimensional array and pointer.

  • (A) int *ptr[N] is an array of N integer pointers. Size is N * sizeof(1*int).
  • (B) int (*ptr)[N] is a pointer to an array of N elements. Size of ptr is size of 1 integer.
  • (C) An multidimensional array or a single dimensional array can contain pointer elements.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. What is a String in C Language?

  • (A) String is a new Data Type in C
  • (B) String is an array of Characters with null character as the last element of array.
  • (C) String is an array of Characters with null character as the first element of array
  • (D) String is an array of Integers with 0 as the last element of array.
πŸ’¬ Discuss
βœ… Correct Answer: (B) String is an array of Characters with null character as the last element of array.

Q. What is the Format specifier used to print a String or Character array in C Printf or Scanf function?

  • (A) %c
  • (B) %C
  • (C) %s
  • (D) %w
πŸ’¬ Discuss
βœ… Correct Answer: (C) %s

Q. What is the maximum length of a C String?

  • (A) 32 characters
  • (B) 64 characters
  • (C) 256 characters
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) None of the above

Q. How do you accept a Multi Word Input in C Language?

  • (A) SCANF
  • (B) GETS
  • (C) GETC
  • (D) FINDS
πŸ’¬ Discuss
βœ… Correct Answer: (B) GETS

Q. Choose a correct C Statement about Strings.

  • (A) PRINTF is capable of printing a multi word string.
  • (B) PUTS is capable of printing a multi word string.
  • (C) GETS is capable of accepting a multi word string from console or command prompt
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. Output is

Code:
int main()
{
int a = 6;
float b = 2;
printf(“%d “, sizeof(++a + b)); printf(“%d “, a);
return 0;
}
  • (A) 9 2
  • (B) 9 6
  • (C) 4 6
  • (D) 5 3
πŸ’¬ Discuss
βœ… Correct Answer: (C) 4 6

Q. The maximum value of unsigned integer when integer needs two byes of storage:

  • (A) 2^15 – 1
  • (B) 2^16
  • (C) 2^16 – 1
  • (D) None
πŸ’¬ Discuss
βœ… Correct Answer: (C) 2^16 – 1

Q. Output is

Code:
#include <stdio.h>
 void main() {    
  int a = 36;   
   int b = 9;     
 printf(“%d”, a>>a/b-2);     
 return 0;
 }
  • (A) 12
  • (B) 10
  • (C) 9
  • (D) 5
πŸ’¬ Discuss
βœ… Correct Answer: (C) 9

Q. When 2 is entered, The output of the code below is?

Code:
#include <stdio.h> 
void main()
 {      
  int ch;        
printf(“enter a value btw 1 to 2:”);        
scanf(“%d”, &ch);       
 switch (ch)      
  {              
 case 1:             
  printf(“1\n”);             
  break;              
 printf(“Hi”);             
  default:               
printf(“2\n”);    
    }
 }
  • (A) 1
  • (B) Hi 2
  • (C) Run time error
  • (D) 2
πŸ’¬ Discuss
βœ… Correct Answer: (D) 2