Question 1 of 25
Hints left: 3
Q1
What will be the output of the following code? void main() { int a[10]; printf("%d %d", a[-1], a[12]); }
Q2
The library function used to find the last occurrence of a character in a string is
Q3
What will be the output of following program code? #include <stdio.h> int main(void) { char p; char buf[10] = {1, 2, 3, 4, 5, 6, 9, 8}; p = (buf + 1)[5]; printf("%d", p); return 0; }
Q4
What will be the output of the following program? void main() { char str1[] = "abcd"; char str2[] = "abcd"; if(str1==str2) printf("Equal"); else printf("Unequal"); }
Q5
What does the following declaration mean? int (*ptr)[10];
Q6
Let x be an array. Which of the following operations are illegal? I. ++x II. x+1 III. x++ IV. x*2
Q7
An array elements are always stored in ________ memory locations.
Q8
How can you check if two strings are equal in C?
Q9
What is right way to Initialize array?
-
A
-
B
-
C
-
D
Q10
What will be the output of the program? #include<stdio.h> int main() { int arr[1] = {10}; printf("%d", 0[arr]); return 0; }
Q11
Which function is used to convert a string to an integer in C?
Q12
Which of the following statements are correct about an array? 1. The array int num[26]; can store 26 elements. 2. The expression num[1] designates the very first element in the array. 3. It is necessary to initialize the array at the time of declaration. 4. The declaration num[SIZE] is allowed if SIZE is a macro.
Q13
If the two strings are identical, then strcmp() function returns
Q14
Array passed as an argument to a function is interpreted as
Q15
What does the fgets function in C do when it encounters a newline character?
Q16
Which of the following is correct way to define the function fun() in the below program? #include<stdio.h> void main() { int a[3][4]; fun(a); }
Q17
Consider the following type definition. typedef char x[10]; x myArray[5]; What will sizeof(myArray) be ? (Assume one character occupies 1 byte)
Q18
Which of the following statements are correct about the program below? #include<stdio.h> void main() { int size, i; scanf("%d", &size); int arr[size]; for(i=1; i<=size; i++) { scanf("%d", arr[i]); printf("%d", arr[i]); } }
Q19
What is the maximum number of dimensions an array in C may have?
Q20
Size of the array need not be specified, when
Q21
What will be the output of the program? #include<stdio.h> void main() { float arr[] = {12.4, 2.3, 4.5, 6.7}; printf("%d", sizeof(arr)/sizeof(arr[0])); }
Q22
What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes? #include<stdio.h> void main() { int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0}; printf("%u, %u", a+1, &a+1); }
Q23
What will be the output of the program if the array begins at address 65486? #include<stdio.h> void main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u", arr, &arr); }
Q24
What will be printed after execution of the following code? void main() { int arr[10] = {1,2,3,4,5}; printf("%d", arr[5]); }
Q25
What will be the output of the program? #include<stdio.h> void main() { int a[5] = {5, 1, 15, 20, 25}; int i, j, m; i = ++a[1]; j = a[1]++; m = a[i++]; printf("%d, %d, %d", i, j, m); }