Day 27 Multiple
Day 27 Multiple
Write the program in system and compile it , then write the output
a. a=(a+b)-(b=a)
b. a=(a-b)-(b=a)
c. b=(b+a)+(a=b)
d. b=(b-a)-(a=b)
2 Which of the following statement is same as a==b
a. a<b || a>b
b. a<b && a>b
c. a>b || b>a
d. a>=b && b>=a
3 What is the output of this C code?
#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
**m = 6;
printf("%d\n", k);
}
a. 5
b. 6
c. Compilation error
c) None
4 Which of the following statement is same as -1^n
a. return n&1 ? -1 : 1;
b. return n&1 ? 1 : 0;
c. return n&0 ? -1 : 1;
d. none
5 Find maximum and minmum of two numbers without using relational operators
a. return x|3
b. return x&3
c. return x^3
d. none
9 Finding square root of a number
a. exp(log(n)/2))
b. exp(log(n)/log(2))
c. pow(n,2)/(log(n)/2)
d. none
10 int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j || ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
}
a. 1,2,0,1
b. -3,2,0,1
c. -2,3,0,1
d. 2,3,1,1
11 Which is the character array used to accept command line arguments?
a. char argv
b. char* argv[]
c. char argv[]
d. char* argv
12 void main()
{
m();
void m()
{
printf(“SimpleWay2Code”);
}
}
a. SimpleWay2Code
b. Compile time error
c. Nothing
d. Varies
13 What is the output
#include "stdio.h"
main()
{
char *str=NULL;
strcpy(str,"cquestionbank");
printf("%s",str);
}
a. cquestionbank
b. cquestionbank\0
c. compilation error
d. run time error
14 Given the below statements about C programming language is true
a. main() function should always be the first function present in a C program file
b. all the elements of an union share their memory location
c. A void pointer can hold address of any type and can be typcasted to any type
d. A static variable hold random junk value if it is not initialized
15 What is the task of pre-processor?
a. Expanding
b. Compiling
c. Linking
d. All of the above
16 Which of the following statements about stdout and stderr are true?
a. strcpy()
b. strcat()
c. strupr()
d. strstr()
21 void main()
{
int i=10;
int *ip=&i;
int **ipp=&&i;
printf("%d %d %d",i,ipp,*ipp);
}
a. address of i , address of i, address of p
b. address of i , address of i, address of 10
c. 10,address of ip, addressof i
d. compile time error
22 Comment on the following
main()
{
int i=1;
if(i<=100)
{
printf("Hello");
i=i+5;
main();
}
}
a. 20 times
b. 100 times
c. infinite times
d. stack overflow
30 main()
{
char x[]="c at lit-2018";
printf("%s",x+x[0]-x[2]);
}
a. c at lit-2018
b. at lit-2018
c. lit-2018
d. none