Here we set two types of Question pattern for you.
1. General Question(GNQ)
2. Objective Question(OBQ).
if you want to submit answers,submit it in comment.
Submission rules:
- For General Question (GNQ):
- 1.Write the program in pasteUbuntu content area.
- 2.Give poster name(your name) and Syntax type.
- 3.Click paste and comment here with your name,problem Genre,number and the link.
- Example:
Your Name, GNQ/4. http://paste.ubuntu.com/16718350
- For Objective Question (OBQ):
- 1.Comment here with your name, problem Genre and answer
- Example:
Your Name, OBQ. 1.a/2.b/3.a/4.d....
- Exercise:
- General Question(GNQ):
Questions will post soon.....
- Objective Questions(OBQ):
1.Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
A. rem = 3.14 % 2.1; B. rem = modf(3.14, 2.1); C. rem = fmod(3.14, 2.1); D. Remainder cannot be obtain in floating point division.
2. What are the types of linkages?A. Internal and External B. External, Internal and None C. External and None D. Internal
3. Which of the following special symbol allowed in a variable name?A. * (asterisk) B. | (pipeline) C. - (hyphen) D. _ (underscore) 4. Is there any difference between following declarations?1 : extern int fun(); 2 : int fun(); A. Both are identical B. No difference, except extern int fun(); is probably in another file C. int fun(); is overrided with extern int fun(); D. None of these 5. How would you round off a value from 1.66 to 2.0?A. ceil(1.66) B. floor(1.66) C. roundup(1.66) D. roundto(1.66) 6. By default a real number is treated as aA. float B. double C. long double D. far double 7. Which of the following is not user defined data type?1 : struct book { char name[10]; float price; int pages; };
2 : long int l = 2.35;
3 : enum day {Sun, Mon, Tue, Wed};
A. 1 B. 2 C. 3 D. Both 1 and 2 8. Is the following statement a declaration or definition?
extern int i;A. Declaration B. Definition C. Function D. Error 9. Identify which of the following are declarations1 : extern int x; 2 : float square ( float x ) { ... } 3 : double pow(double, double); A. 1 B. 2 C. 1 and 3 D. 3 10. In the following program where is the variable a getting defined and where it is getting declared?#include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20;
A. extern int a is declaration, int a = 20 is the definition B. int a = 20 is declaration, extern int a is the definition C. int a = 20 is definition, a is not defined D. a is declared, a is not defined 11. When we mention the prototype of a function?A. Defining B. Declaring C. Prototyping D. Calling 12. What is the output of the program given below ?#include<stdio.h> int main() { enum status { pass, fail, atkt}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = atkt; stud3 = fail; printf("%d, %d, %d\n", stud1, stud2, stud3); return 0; }
A. 0, 1, 2 B. 1, 2, 3 C. 0, 2, 1 D. 1, 3, 2 13. What will be the output of the program in 16 bit platform (Turbo C under DOS)?#include<stdio.h> int main() { extern int i; i = 20; printf("%d\n", sizeof(i)); return 0; }
A. 2 B. 4 C. vary from compiler D. Linker Error : Undefined symbol 'i' 14. What is the output of the program?#include<stdio.h> int main() { extern int a; printf("%d\n", a); return 0; } int a=20;
A. 20 B. 0 C. Garbage Value D. Error 15. What is the output of the program in Turbo C (in DOS 16-bit OS)?#include<stdio.h> int main() { char *s1; char far *s2; char huge *s3; printf("%d, %d, %d\n", sizeof(s1), sizeof(s2), sizeof(s3)); return 0; }
A. 2, 4, 6 B. 4, 4, 2 C. 2, 4, 4 D. 2, 2, 2 16. What is the output of the program#include<stdio.h> int main() { struct emp { char name[20]; int age; float sal; }; struct emp e = {"Tiger"}; printf("%d, %f\n", e.age, e.sal); return 0; }
A. 0, 0.000000 B. Garbage values C. Error D. None of above 17. What will be the output of the program?#include<stdio.h> int X=40; int main() { int X=20; printf("%d\n", X); return 0; }
A. 20 B. 40 C. Error D. No Output 18. What is the output of the program#include<stdio.h> int main() { int x = 10, y = 20, z = 5, i; i = x < y < z; printf("%d\n", i); return 0; }
A. 0 B. 1 C. Error D. None of these 19. What is the output of the program#include<stdio.h> int main() { extern int fun(float); int a; a = fun(3.14); printf("%d\n", a); return 0; } int fun(int aa) { return (int)++aa; }
A. 3 B. 3.14 C. 0 D. 4 E. Compile Error 20. What is the output of the program?#include<stdio.h> int main() { union a { int i; char ch[2]; }; union a u; u.ch[0] = 3; u.ch[1] = 2; printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i); return 0; }
A. 3, 2, 515 B. 515, 2, 3 C. 3, 2, 5 D. None of these 21. In the following program how long will the for loop get executed?#include<stdio.h> int main() { int i=5; for(;scanf("%s", &i); printf("%d\n", i)); return 0; }
A. The for loop would not get executed at all B. The for loop would get executed only once C. The for loop would get executed 5 times D. The for loop would get executed infinite times 22. What will be the output of the program?#include<stdio.h> int main() { int X=40; { int X=20; printf("%d ", X); } printf("%d\n", X); return 0; }
A. 40 40 B. 20 40 C. 20 D. Error 23. Point out the error in the following program (if it is compiled with Turbo C compiler).#include<stdio.h> int main() { display(); return 0; } void display() { printf("IndiaBIX.com"); }
A. No error B. display() doesn't get invoked C. display() is called before it is defined D. None of these 24. Point out the error in the following program.#include<stdio.h> int main() { void v = 0; printf("%d", v); return 0; }
A. Error: Declaration syntax error 'v' (or) Size of v is unknown or zero. B. Program terminates abnormally. C. No error. D. None of these.
25. Point out the error in the following program.#include<stdio.h> struct emp { char name[20]; int age; }; int main() { emp int xx; int a; printf("%d\n", &a); return 0; }
A. Error: in printf B. Error: in emp int xx; C. No error. D. None of these. 26. Which of the following is correct about err used in the declaration given below?typedef enum error { warning, test, exception } err;
A. It is a typedef for enum error. B. It is a variable of type enum error. C. The statement is erroneous. D. It is a structure. 27. Point out the error in the following program.#include<stdio.h> int main() { int (*p)() = fun; (*p)(); return 0; } int fun() { printf("IndiaBix.com\n"); return 0; }
A. Error: in int(*p)() = fun; B. Error: fun() prototype not defined C. No error D. None of these 28. Which of the declaration is correct?A. int length; B. char int; C. int long; D. float double; 29. Which of the following operations are INCORRECT?A. int i = 35; i = i%5;
B. short int j = 255; j = j;
C. long int k = 365L; k = k;
D. float a = 3.14; a = a%3;
30. Which of the following correctly represents a long double constant?A. 6.68 B. 6.68L C. 6.68f D. 6.68LF 31. Which of the structure is incorrcet?1 : struct aa { int a; float b; };
2 : struct aa { int a; float b; struct aa var; };
3 : struct aa { int a; float b; struct aa *var; };
A. 1 B. 2 C. 3 D. 1, 2, 3 32. Which of the structure is correct?1 : struct book { char name[10]; float price; int pages; };
2 : struct aa { char name[10]; float price; int pages; }
3 : struct aa { char name[10]; float price; int pages; }
A. 1 B. 2 C. 3 D. All of above
33. 1 : typedef long a;
extern int a c;2 : typedef long a;
extern a int c;3 : typedef long a;
extern a c;A. 1 correct B. 2 correct C. 3 correct D. 1, 2, 3 are correct 34. A long double can be used if range of a double is not enough to accommodate a real number.A. True B. False 35. A float is 4 bytes wide, whereas a double is 8 bytes wide.A. True B. False 36. If the definition of the external variable occurs in the source file before its use in a particular function, then there is no need for an extern declaration in the function.A. True B. False
37. Size of short integer and long integer can be verified using the sizeof()operator.A. True B. False 38. Range of double is -1.7e-38 to 1.7e+38 (in 16 bit platform - Turbo C under DOS)A. True B. False 39. Size of short integer and long integer would vary from one platform to another.A. True B. False 40. Range of float id -2.25e+308 to 2.25e+308A. True B. False 41. Is there any difference in the following declarations?
int myfun(int arr[]);
int myfun(arr[20]);A. Yes B. No 42. Suppose a program is divided into three files f1, f2 and f3, and a variable is defined in the file f1 but used in files f2 and f3. In such a case would we need the externdeclaration for the variables in the files f2 and f3?A. Yes B. No 43. Global variable are available to all functions. Does there exist a mechanism by way of which it available to some and not to others.A. Yes B. No 44. Is it true that a global variable may have several declarations, but only one definition?A. Yes B. No 45. Is it true that a function may have several declarations, but only one definition?A. Yes B. No 46. What will be the output of the program?#include<stdio.h> int main() { float a=0.7; if(a < 0.7) printf("C\n"); else printf("C++\n"); return 0; }
A. C B. C++ C. Compiler error D. Non of above 47. How many times "IndiaBIX" is get printed?#include<stdio.h> int main() { int x; for(x=-1; x<=10; x++) { if(x < 5) continue; else break; printf("IndiaBIX"); } return 0; }
A. Infinite times B. 11 times C. 0 times D. 10 times 48. How many times the while loop will get executed if a short int is 2 byte wide?#include<stdio.h> int main() { int j=1; while(j <= 255) { printf("%c %d\n", j, j); j++; } return 0; }
A. Infinite times B. 255 times C. 256 times D. 254 times 49. What will be the output of the program?#include<stdio.h> int main() { int i=0; for(; i<=5; i++); printf("%d", i); return 0; }
A. 0, 1, 2, 3, 4, 5 B. 5 C. 1, 2, 3, 4 D. 6 50. What will be the output of the program?#include<stdio.h> int main() { int a = 500, b = 100, c; if(!a >= 400) b = 300; c = 200; printf("b = %d c = %d\n", b, c); return 0; }
A. b = 300 c = 200 B. b = 100 c = garbage C. b = 300 c = garbage D. b = 100 c = 200 51. What will be the output of the program?#include<stdio.h> int main() { int x=1, y=1; for(; y; printf("%d %d\n", x, y)) { y = x++ <= 5; } printf("\n"); return 0; }
A. 2 1
3 1
4 1
5 1
6 1
7 0B. 2 1
3 1
4 1
5 1
6 1C. 2 1
3 1
4 1
5 1D. 2 2
3 3
4 4
5 5
52. What will be the output of the program?#include<stdio.h> int main() { int i=3; switch(i) { case 1: printf("Hello\n"); case 2: printf("Hi\n"); case 3: continue; default: printf("Bye\n"); } return 0; }
A. Error: Misplaced continue B. Bye C. No output D. Hello Hi 53. Point out the error, if any in the program.#include<stdio.h> int main() { int i = 1; switch(i) { printf("This is c program."); case 1: printf("Case1"); break; case 2: printf("Case2"); break; } return 0; }
A. Error: No default specified B. Error: Invalid printf statement after switch statement C. No Error and prints "Case1" D. None of above 54. What will be the output of the program ?#include<stdio.h> int 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); return 0; }
A. 2, 1, 15 B. 1, 2, 5 C. 3, 2, 15 D. 2, 3, 20 55. What will be the output of the program ?#include<stdio.h> int main() { static int a[2][2] = {1, 2, 3, 4}; int i, j; static int *p[] = {(int*)a, (int*)a+1, (int*)a+2}; for(i=0; i<2; i++) { for(j=0; j<2; j++) { printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i), *(*(i+p)+j), *(*(p+j)+i)); } } return 0; }
A. 1, 1, 1, 1
2, 3, 2, 3
3, 2, 3, 2
4, 4, 4, 4B. 1, 2, 1, 2
2, 3, 2, 3
3, 4, 3, 4
4, 2, 4, 2C. 1, 1, 1, 1
2, 2, 2, 2
2, 2, 2, 2
3, 3, 3, 3D. 1, 2, 3, 4
2, 3, 4, 1
3, 4, 1, 2
4, 1, 2, 356. Which of the following is correct way to define the function fun() in the below program?#include<stdio.h> int main() { int a[3][4]; fun(a); return 0; }
A. void fun(int p[][4]) { }
B. void fun(int *p[4]) { }
C. void fun(int *p[][4]) { }
D. void fun(int *p[3][4]) { }
57. What will be the output of the program ?#include<stdio.h> int main() { enum days {MON=-1, TUE, WED=6, THU, FRI, SAT}; printf("%d, %d, %d, %d, %d, %d\n", MON, TUE, WED, THU, FRI, SAT); return 0; }
A. -1, 0, 1, 2, 3, 4 B. -1, 2, 6, 3, 4, 5 C. -1, 0, 6, 2, 3, 4 D. -1, 0, 6, 7, 8, 9 58. Point out the error in the program?#include<stdio.h> int main() { struct a { float category:5; char scheme:4; }; printf("size=%d", sizeof(struct a)); return 0; }
A. Error: invalid structure member in printf B. Error in this float category:5; statement C. No error D. None of above 59. Which of the following is the correct order if calling functions in the below code?
a = f1(23, 14) * f2(12/4) + f3();A. f1, f2, f3 B. f3, f2, f1 C. Order may vary from compiler to compiler D. None of above
60. What will be the output of the program ?#include<stdio.h> int main() { printf(5+"Good Morning\n"); return 0; }
A. Good Morning B. Good C. M D. Morning
61. What will be the output of the program ?#include<stdio.h> #include<string.h> int main() { char sentence[80]; int i; printf("Enter a line of text\n"); gets(sentence); for(i=strlen(sentence)-1; i >=0; i--) putchar(sentence[i]); return 0; }
A. The sentence will get printed in same order as it entered B. The sentence will get printed in reverse order C. Half of the sentence will get printed D. None of above
62. The keyword used to transfer control from a function back to the calling function isA. switch B. goto C. go back D. return 63. What is the notation for following functions?1. int f(int a, float b) { /* Some code */ } 2. int f(a, b) int a; float b; { /* Some code */ }
A. 1. KR Notation
2. ANSI NotationB. 1. Pre ANSI C Notation
2. KR NotationC. 1. ANSI Notation
2. KR NotationD. 1. ANSI Notation
2. Pre ANSI Notation
64. What will be the output of the program?#include<stdio.h> void fun(int*, int*); int main() { int i=5, j=2; fun(&i, &j); printf("%d, %d", i, j); return 0; } void fun(int *i, int *j) { *i = *i**i; *j = *j**j; }
A. 5, 2 B. 10, 4 C. 2, 5 D. 25, 4
65. What will be the output of the program?#include<stdio.h> int reverse(int); int main() { int no=5; reverse(no); return 0; } int reverse(int no) { if(no == 0) return 0; else printf("%d,", no); reverse (no--); }
A. Print 5, 4, 3, 2, 1 B. Print 1, 2, 3, 4, 5 C. Print 5, 4, 3, 2, 1, 0 D. Infinite loop
No comments:
Post a Comment