wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

day8

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

a)

10

b)

9

c)

11

d)

100

2.

a)

phisoft

b)

Amphisoft

c)

ft

d)

Am

3.

What will be output of the given code?

#include<stdio.h>

int main(){

char str[100] = "cprog";

printf ("%d", sizeof(str));

return 0;

}

a)

100

b)

1

c)

5

d)

4

4.

Fill in the blanks in the below program to print "her".


#include <stdio.h>

int main() {

char arr[] = "teacher";

printf("%s", (a)   );

return 0;

}

5.

What will be the output of the given code?


#include <stdio.h>

int main() {

printf("java","compiler");

return 0;

}

a)

compile time error

b)

java

c)

java compiler

d)

compiler

6.

What will be the output of the given code?

#include<stdio.h>

#include<string.h>

int main(){

char str[] = "java\0compiler\0";

printf("%s\n", str);

return 0;

}

a)

java

b)

compiler

c)

java compiler

d)

compile time error

7.

What will be the output of the given code?

#include<stdio.h>

int main(){

printf(3+"java compiler\n");

return 0;

}

a)

java

b)

comp

c)

a compiler

d)

iler

e)

error

8.

What is the Format specifier used to print a String or Character array in C Printf or Scanf function.?

a)

%c

b)

%C

c)

%s

d)

%S

9.

What is the output of C Program with arrays.?

int main()

{

char str[]={"C","A","T","\0"};

printf("%s",str);

return 0;

}

a)

C

b)

CAT

c)

CAT\0

d)

Compiler error

10.
a)

java

b)

ja

c)

Compiler error

d)

none of the above