C Language Quiz 6

2
Created on By nanacharya123

C language Questions

1 / 10

Q 1 - What is the output of the following code snippet?

#include<stdio.h>

main() {

int *p = 15;

printf("%d",*p);

}

2 / 10

Q .2 What is the output of the following program?

#include<stdio.h>

main() {

char *s = "Hello, " "World!";

printf("%s", s);

}

3 / 10

3. What will be the output of the program?

# include<stdio.h>

int main(){

char a = 1;

while(a<10)

{

printf("%d ", a);

a = a+1;

}

printf(" ");

return 0;

}

4 / 10

4. What will be the output of the program?

#include <stdio.h>

int main(){

int i = 10;

float f = 10.0;

if (i==f)

printf("i and f are equal");

else

printf("i and f are not equal");

return 0;

}

5 / 10

5. What will be the output of the program?

# include <stdio.h>
# include <conio.h>

enum State {Working, Failed, Freezed};

int main(){
enum State day;
printf("%d %d %d", Working, Failed, Freezed);

return 0;
}

6 / 10

6. The keyword used to transfer control from a function back to the calling function is

7 / 10

7. What will be the output of the program?

#include<stdio.h>

int main()
{
int n =151, c;

for (c = 2; c <= n/2; c++)
{
if (n%c == 0)
{
printf("%d is a composite number.\n", n);
break;
}
}

if (c == n/2 + 1)
printf("%d is prime.\n", n);

return 0;
}

 

8 / 10

8. What will be output if you will compile and execute the following code?

#include<stdio.h>

int main(){

int a=10, b=15, c=20;

printf("%d %d %d");

return 0;

}

9 / 10

9. What will be the output of the program?

#include <stdio.h>
#include <conio.h>

int main(){

int first=10, second=20, add, subtract, multiply;
float divide, modulus;
add = first + second;
subtract = first - second;
multiply = first * second;
divide = first / (float)second;
modulus = first % second;

printf("Sum = %d %d %d %d %d \n",add, subtract, multiply, divide, modulus);

return 0;

}

10 / 10

10.  What is the output of the following program?

#include<stdio.h>

void main()
{
char s[] = "C++";

printf("%s ",s);
s++;
printf("%s",s);
}

Your score is

The average score is 40%

0%