Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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?
Ans: B
Q.6) What will be the output if you compile and execute the following c code?
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; }
Ans: A
#include <stdio.h> #include <string.h> int main() { inti=0; for(;i<=2;) printf(" %d",++i); return0; }
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.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
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)
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)
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
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.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
Ans: C)
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)
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."); }
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.
=*/%+*%/-+=
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.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
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.56) To clear the screen we use A) getch() Ans: B) B) clrscr() C) get() D) put()
Q. 59) A function returns only one value at a time. A) True Ans: A) B) False