MCQ

100 Multiple Choice Questions In C Programming – Part 9

This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
 

1. Which of these function prototypes does not allow an array to be passed?

A void myFunction ( int arr[], int size);

B void myFunction ( int []arr, int size);

C void myFunction ( int arr, int size);

D void myFunction ( int * arr, int size);

B, C

 

 

2. An array Arr of 10 integers is stored at the address 0028FF10, where is T[5] address?

A 0028FF15

B 0028FF20

C 0028FF24

D 0028FF25

C

 

 
 

3. What is the correct method of initializing an array of integers?

A int arr[4] = 10,5,8,9;

B int arr[4] = [10,5,8,9];

C int arr[4] = {10,5,8,9};

D int arr[4] = (10,5,8,9);

C

 

 

4. What is the output of the following code?
int N = 65;
char letter = N;
printf ("%d", letter);

A 65

B N

C A

D Compilation error

A

 

 

5. What is a String in C?

A A char variable

B An array of char

C An array of int

D An array of long

B

 

 
 

6. What is the output of the following code?
#include <stdio.h>

int main()
{
    int j = -3;
    int a = j % 2;
    printf("%d\n", a);
}

A 0

B 1

C -1

D Compilation error

C

 

 

7. What is the output of the following code?
#include <stdio.h>

int main()
{
   int j = 3;
   int a = j / -2;
   int b = j % -2;
   printf("%d %d\n", a, b);
   return 0;
}

A -1 1

B 1 -1

C -1 0

D Compilation error

A

 

 

8. What is the output of the following code?
#include <stdio.h>

int main()
{
   int j = 5;
   j = j / 3;
   printf("%d\n", j);
   return 0;
}

A 3

B 1

C 5

D Compilation error

B

 

 
 

9. How to capture a String in C (declared by: char str[100])?

A scanf ("%c" , str);

B scanf ("%s" , str);

C scanf ("%c" ,&str);

D scanf ("%s" , &str);

B

 

 

10. Which function gives the length of a string?

A LengthString();

B strlen();

C len();

D size();

B

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *