Sunteți pe pagina 1din 19

Q.1) A function that calls itself for its processing is known as A. Inline Function B. Nested Function C.

Overloaded Function D. Recursive Function Ans: D Q.2) We declare a function with ______ if it does not have any return type A. long B. double C. void D. int

Ans: C

Q.3) Arguments of a function are separated with A. comma B. semicolon C. colon D. None of these

Ans: A

Q.4) Variables inside parenthesis of functions declarations have _____ level access A. Local B. Global C. Module

D. Universal

Ans: A

Q.5) What is the output if you will compile and execute the following c code?

#include<stdio.h> #definex 5+2 int main() { inti; i=x*x*x; printf("%d",i); return0; }

A. 343 B. 27 C.. 133 D. Compiler error E. None of above

Ans: B

Q.6) What will be the output if you compile and execute the following c code?

#include<stdio.h> int main() { inti=4,x; x=++i + ++i + ++i; printf("%d",x); return0; }

A. 21 B. 18 C.. 12 D. Compiler error E. None of above

Ans: A

Q.7) What is the output of following c code? #include<stdio.h> int main() { inta=10; printf("%d %d %d",a,a++,++a); return0; }

A. 12 11 11 B. 12 10 10 C.. 11 11 12 D. 10 10 12 E. Compiler error

Ans: A

Q.8) What will be the output of following c code?

#include <stdio.h> #include <string.h> int main() { inti=0; for(;i<=2;) printf(" %d",++i); return0; }

A.0 1 2 B. 0 1 2 3 C. 1 2 3 D. Compiler error

E. Infinite loop

Ans: C

Q.9) A pointer is

A. A keyword used to create variables B. A variable that stores address of an instruction C. A variable that stores address of other variable D. All of the above Ans: C

Q.10) In which order do the following gets evaluated

1. Relational 2. Arithmetic 3. Logical 4. Assignment

A. 2134 B. 1234 C. 4321 D. 3214 Ans: A

Q.11) What will be the output if you will compile and execute the following c code? #include<stdio.h> void main() { int i; for(i=1;i<=5;i++); printf("%d",i); }

(A) 4 (B) 5 (C) 6 (D) Compiler error (E) None of the above

Ans: (C)

Q.12) What will be the output if you will compile and execute the following c code? #include<stdio.h> void main() { printf(%d, sizeof(10)); }

(A) 2

(B) 4 (C) 6 (D) 8

Ans: (A) Q.13) Which of the following is the correct way of declaring a float pointer: A) float ptr; B) float *ptr; C) *float ptr; D) None of the above

Ans: (B)

Q.14) Array passed as an argument to a function is interpreted as

A) Address of the array B) Values of the first elements of the array C) Address of the first element of the array D) Number of element of the array

Ans: C)

Q.15) #include <stdio.h> void main() {

int I=3,*j,**k; j=&I; k=&j; printf("%d%d%d",*j,**k,*(*k)); } What is the output of the above program code? A) 4 4 4 B) 0 0 0 C) 3 3 3 D) 4 3 3

Ans: C)

Q.16) Which of the following special symbol allowed in a variable name? A.* (asterisk) B.| (pipeline) C.- (hyphen) D._ (underscore)

Ans: D)

Q.17) A long double can be used if range of a double is not enough to accommodate a real number. A. True Ans: A) True B. False

Q.18) A float is 4 bytes wide, whereas a double is 8 bytes wide.

A. True

B.

False

Ans: A) True

Q.19) 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

Ans: A) True

Q.20) Size of short integer and long integer can be verified using the sizeof() operator. A. True B. False

Ans: A) True

Q.21) Range of float id -2.25e-308 to 2.25e+308 A. True B. False

Ans: B) False. The range of float is -3.4e-38 to 3.4e+38.

Q.22) 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 extern declaration for the variables in the files f2 and f3? A. Yes B. No

Ans: A) Yes

Q.23) 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

Ans: B) No

Q.24) Is it true that a global variable may have several declarations, but only one definition? A. Yes Ans: A) Yes http://www.indiabix.com/c-programming/declarations-and-initializations/ Q.25) How many times "Welcome" is get printed? #include<stdio.h> void main() { int x; for(x=1; x<=10; x++) { if(x < 5) continue; else break; printf("Welcome"); } } B. No

A. Infinite times B. 11 times C. 0 times D. 10 times

Ans: C)

Q.26) Which of the following is not logical operator?

A. & B. && C. || D. !

Ans: A)

Q.27) In mathematics and computer programming, which is the correct order of mathematical operators ?

A. Addition, Subtraction, Multiplication, Division B. Division, Multiplication, Addition, Subtraction C. Multiplication, Addition, Division, Subtraction D. Addition, Division, Modulus, Subtraction

Ans: B)

Q.28) Which of the following cannot be checked in a switch-case statement?

A. Character B. Integer

C. Float D. enum

Ans: C)

Q.29) What is the output of the code: int a=2, b=3; (a>b): printf(%d,a): printf(%d,b);

A) 2 Ans: A)

B) 3

C) 4

D) None of above

Q.30) What will be the output of the program? #include<stdio.h> void main() { int k, num = 30; k = (num < 10) ? 100 : 200; printf("%d\n", num); }

A. 200 Ans: B)

B. 30

C. 100

D.500

Q.31) What will be the output of the program? #include<stdio.h> void main() {

int i=2; switch(i) { case 1: printf("\n\t I am in case 1."); break; case 2: printf("\n\t I am in case 2."); case 3: printf("\n\t I am in case 3."); break; default: printf("\n\t Invalid option."); }

A. I am in case 1. I am in case 2. C. I am in case 2. Ans: B)

B. I am in case 2. I am in case 3. D. Invalid option.

Q.32) Which of the following is the correct order of evaluation for the below expression? z=x+y*z/4%2-1

A. * / % + - = C. / * % - + = Ans: A)

B. D.

=*/%+*%/-+=

Q.33) Which of the following are unary operators in C? 1. ! 2. Sizeof 3. ~ 4. &&

A. 1, 2 C. 2, 4 Ans: D)

B. D.

1, 3 1, 2, 3

Q.34) What will be the output of the program? #include<stdio.h> void main() { int x=12, y=7, z; z = x!=4 || y == 2; printf("z=%d\n", z); }

A. z=0 Ans: B)

B.

z=1

C.

z=4

D.

z=2

Q.35) What will be the output of the program? #include<stdio.h> void main() { int x=4, y, z; y = --x; z = x--; printf("%d, %d, %d\n", x, y, z); }

A. 4, 3, 3 C. 3, 3, 2 Ans: D)

B. D.

4, 3, 2 2, 3, 3

Q. 36) Associativity has no role to play unless the precedence of operator is same.

A. True Ans: A)

B.

False

Q.37) The keyword used to transfer control from a function back to the calling function is A. switch C. go back Ans: D) B. D. goto return

Q.38) Functions can be called either by value or reference A. True Ans: A) B. False

Q.39) Usually recursion works slower than loops. A. Yes Ans: A) B. No

Q.40) The operator used to get value at address stored in a pointer variable is A. * B. &

C. && Ans: A)

D.

||

Q.41) All the statements will increment the value of a by 1. a=a+1; a++; ++a; A) True Ans: A) B) False

Q.42) Which of the following function is more appropriate for reading in a multi-word string? A. printf(); C. gets(); Ans: C) B. D. scanf(); puts();

Q.43) A string the collection of one dimensional array of characters. A. True Ans: A) B. False

Q.44) C programming language is designed by A. Dennis Ritchie C. James Gosling Ans: A) B. D. Bjarne Stroustrup None of the above

Q.45) Keywords in C programming can not be used as a variable name.

A) True Ans: A)

B) False.

Q.46) Memory utilization in union is better than structure. A) True Ans: A) B) False.

Q.47) There are total 32 keywords in C Programming Language. A) True Ans: A) B) False.

Q.48) %d is the format specifier for float data type. A) True Ans: B) B) False.

Q.49) Array is a collection of __________ type of values stored in a continuous memory location. A) Different Ans: B) B) Similar C) Both D) None of the above.

Q.50) Structure is the collection of ___________ type of values stored in a continuous memory location. A) Different Ans: A) B) Similar C) Both D) None of the above.

Q.51) Size of structure variable is equal to the size of sum all its member.

A) True Ans: A)

B) False

Q.52) Size of structure is equal to the size of union. A) True Ans: B) B) False

Q. 53) strlen() unction is used to find the length of the string. A) True Ans: A) B) False

Q.54) Which of the following is used to reverse the string A) strlen() Ans: B) B) strrev() C) strcat() D) strcmp()

Q.55) A new line character is A) \0 Ans: B) B) \n C) \a D) \b

Q.56) To clear the screen we use A) getch() Ans: B) B) clrscr() C) get() D) put()

Q.5 7) C language is A) Procedural Language B) OOP

C) Fully OOP Ans: A)

D) None of the above

Q.58) We can not design our functions in C. A) True Ans: B) B) False

Q. 59) A function returns only one value at a time. A) True Ans: A) B) False

Q. 60) How many storage classes are there in C? A) 1 Ans: D) B) 2 C) 3 D) 4

S-ar putea să vă placă și