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);
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
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);
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
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
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
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
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
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);
10. Which function gives the length of a string?
A LengthString();
B strlen();
C len();
D size();