Adblocker Detected
Quizack provides Online Quiz and Practice MCQs for Free. Please disable your Ad-Blocker so we can earn from ads and keep this project alive.
1. What will be the output of the following program, assuming that data type short takes 2 bytes for storage? struct node { unsigned char bit1 : 1; unsigned char bit2 : 1; unsigned short bit3 : 7; } node1; main() { int size = sizeof(node1); printf('%d', size); }
2. The declaration int *(*p)[10] indicates:
3. What will be printed on the standard output as a result of the following code snippet? void main() { int i,j,k; i=4; j=30; k=0; k=j++/i++; ++k; printf('%d %d %d',i,j,k); }
4. Which one is the correct way of initializing a two-dimensional array?
5. Read the statement below: extern int a; Which statement/s pertaining to the above statement is/are correct?
6. In order to read structures/records from a file, which function will you use?
7. Which sets of conversion statements may result in the loss of data?
8. What would be printed on the standard output as a result of the following code snippet? main() { char *s='Hello World'; char s1[20], s2[20]; int len = sscanf(s,'%s',s1); printf('%s : %d', s1, len); }
9. Which is/are the type/s of memory allocation that needs/need the programmer to take care of memory management?
10. Suppose there is a file a.dat which has to be opened in the read mode using the FILE pointer ptr1, what will be the correct syntax?
11. Given the following array: char books[][40]={ 'The Little World of Don Camillo', 'To Kill a Mockingbird', 'My Family and Other Animals', 'Birds, Beasts and Relatives' }; what would be the output of printf('%c',books[2][5]);?
12. Which function will you use to position the file pointer at the beginning of the file?
13. What would be printed on the standard output as a result of the following code snippet? main() { int arr[10]; int a = sizeof(arr); printf('%d\n',a); return 0; }
14. What will happen if you assign a value to an element of an array the subscript of which exceeds the size of the array?
15. Which function returns the current pointer position within a file?
16. Which one is not a string function?
17. Which function will convert a string into an integer?
18. What is the return value in case a file is not opened successfully by using fopen()?
19. What would be printed on the standard output as a result of the following code snippet? main( ) { char *str[ ] = { 'Manish' 'Kumar' 'Choudhary' }; printf ( '\nstring1 = %s', str[0] ); printf ( '\nstring2 = %s', str[1] ); printf ( '\nstring3 = %s', str[2] ); }
20. What is the return type of the following function declaration? func(char c);
21. What would be the output of the following code snippet? int b = 5; main() { void addup (int b); int i; for(i=1; i<=5; i++) addup(1); return 0; } void addup (int b) { static int v1; v1 = v1+b; printf('%d ', v1); }
22. Identify the incorrect statement.
23. Given the array: int num[3][4]= { {3,6,9,12}, {15,25,30,35}, {66,77,88,99} }; what would be the output of *(*(num+1)+1)+1?
24. What would be printed on the standard output as a result of the following code snippet? #include main() { unsigned char a=255; a = a+1; printf('%d',a); return 0; }
25. What would be printed on the standard output as a result of the following code snippet? main() { void addup (int b); addup(b); return 0; } int b = 5; void addup (int b) { static int v1; v1 = v1+b; printf('%d ', v1); }
26. What would be printed on the standard output as a result of the following code snippet? #define max(a, b) ((a) > (b)?(a):(b)) main() { int a=4; float b=4.5; printf('%.2f\n',max(a, b)); }
27. If a two dimensional array arr[4][10](an array with 4 rows and 10 columns) is to be passed in a function, which of the following would be the valid parameters in the function definition?
28. Is the following statement correct? If not, why not? If yes, what is the size of the array? int array[][3] = { {1,2}, {2,3}, {3,4,2} };
29. Which statements will result in a compilation error?
30. Which comparison statement will be true if an integer is 16 bits and a long is 32 bits on a machine?
31. What will be printed on the standard output as a result of the following code snippet? void main() { char arr[] = {'R','A','M','\0'}; printf('%d',strlen(arr)); }
32. What will be printed on the standard output as a result of the following code snippet? void main() { char arr[] = {'R','A','M'}; printf('%d',strlen(arr)); }
33. Which standard function is used to deallocate memory allocated by the malloc() function?
34. What would be printed on the standard output as a result of the following code snippet? char i = 'A'; char *j; j = & i; *j = *j + 32; printf('%c',i);
35. Which one is not a type of operator ?
36. Which statements are correct for the keyword register?
37. An array is defined with the following statement in a file, file1.c int a[ ] = { 1, 2, 3, 4, 5, 6 }; In another file, file2.c, the following code snippet is written to use the array a: extern int a[]; int size = sizeof(a); What is wrong with the above code snippet?
38. What would be printed on the standard output as a result of the following code snippet? int Recur(int num) { if(num==1 || num==0) return 1; if(num%2==0) return Recur(num/2)+2; else return Recur(num-1)+3; } int main() { int a=9; printf('%d\n', Recur(a)); return 0; }
39. Which is/are the correct signature/s of main with command line arguments?
40. What will happen when the following code is executed? { int num; num =0; do {-- num; printf('%d\n', num); num++; } while (num >=0); }
41. Given the following array: int a[8] = {1,2,3,4,5,6,7,0}; what would be the output of printf('%d',a[4]); ?
42. What will be printed on the standard output as a result of the following code snippet? void main() { int arr[5]={1,2,3,4,5}; printf('%d\n', *(arr+4)); }
43. What will happen when the following code is executed? void main() { char arr1[] = 'REGALINT'; char arr2[10] = 'REGALINT'; printf('%d,',sizeof(arr1)); printf('%d',sizeof(arr2)); }
44. What would be printed on the standard output as a result of the following code snippet? main() { int a[5] = {1,4,5,6,9}; printf('%d\t', *a); //Line 1 printf('%d', *++a); //Line 2 return 0; }
45. What would be printed on the standard output as a result of the following code snippet? #define max(a, b)((a) > (b)?(a):(b)) main() { int a=4, c = 5; printf('%d ', max(a++, c++)); printf('%d %d\n', a,c); }
46. What would be printed on the standard output as a result of the following code snippet? main() { char *pmessage = 'asdfgh'; *pmessage++; printf('%s', pmessage); return 0; }
47. Which function allocates memory and initializes elements to 0?
48. Which standard function is used to close a file?
49. Select the correct statement about arrays.
50. What will be printed on the standard output as a result of the following code snippet? void func() { static int i = 1; int j = 1; i++; j++; printf('%d %d ',i,j); } void main() { func(); func(); func(); }
51. What does the following function do? int fn(unsigned int x) { int count = 0; for(; x!=0; x&=(x-1)) count++; return count; }
52. Which function is used to extract formatted input from a file?
53. Which of the following declarations of structures is/are valid? 1) struct node { int count; char *word; struct node next; }Node; 2) struct node { int count; char *word; struct node *next; }Node; 3) struct node { int count; char *word; union u1 { int n1; float f1; }U; }Node;
54. What is wrong with the following function prototype statement? int func();
55. Which one is not a storage type?
56. What will be printed on the standard output as a result of the following code snippet? void main() { int arr[][2] = {1,2,3,4,5,6}; printf('%d',arr[2][1]); }
57. What would be printed on the standard output as a result of the following code snippet? main() { int i=5; char option = 5; switch(option) { case '5': printf('case : 1 \n'); break; case i: printf('case : 2 \n'); break; default: printf('case : 3 \n'); break; } return 0; }
58. Which statements is valid and correct?
59. The declaration int (*p[5])() means:
60. What would be printed on the standard output as a result of the following code snippet? main() { enum {red, green, blue = 0, white}; printf('%d %d %d %d', red, green, blue, white); return 0; }
61. What is the function to concatenate two strings?
62. Which one is not a valid mode for opening a file?
63. Which function will convert a string into a double precision quantity?
64. What would be printed on the standard output as a result of the following code snippet? main() { int n=5, x; x = n++; printf('%d ', x); x = ++n; printf('%d ', x++); printf('%d', x); return 0; }
65. What will be the output of the following program? #include main() { int n = 5; assert(n > 3); //statement 1 n = n+2; assert(n > 7);//statement 2 return 0; }
66. Which file mode would mean read + append?
67. What will be printed on the standard output as a result of the following code snippet? int funr(int x, int y) { if(x <= 0) { return y; } else { return (1+funr(x-1,y)); } } void main() { printf('%d',funr(2,3)); }
68. Which one is the correct way of initializing a two-dimensional array?
69. Which header file are methods(or macros) isalpha(), islower() a part of?
70. What will be the output of following code? int main() { int i; i = 0; for (i = 1; i <2; i++) { i++; printf( '%d', i ); continue; printf('%d', i ); } return 0; }
71. Read the following two declaration statements. 1. #include 2. #include 'stdio.h' Which of the following statements pertaining to the above two statements are correct?
72. What does the argv[0] represent?
73. What would be printed on the standard output as a result of the following code snippet? char *str1 = 'Hello World'; strcat(str1, '!'); printf('%s', str1);
74. What will be printed on the standard output as a result of the following code snippet? void main() { int num1 = 30, num2 = 4; float result; result = (float)(num1/num2); printf('%.2f', result); return 0; }
75. Which function will you use to write a formatted output to the file?
76. By which file function you can position the file pointer in accordance with the current position?
Visual Basic 6
Assembla
E4X (ECMAScript for XML)
YAML Programming
Yahoo Tools and Libraries
Yahoo YAP
Related MCQ's