wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Strings in C - Part 1

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.
a)

Compilation Error

b)

14

c)

13

d)

Garbage Value

2.
a)

321004

b)

3210

c)

01234

d)

400123

e)

432100

3.

Pick all correct statements.

a)

int A[][]={1,2,3,4};

b)

int A[2][]={1,2,3,4};

c)

int A[][2]={1,2,3,4};

d)

int A[2][2]={1,2,3,4};

4.

if two strings are identical then function strcmp() returns

a)

0

b)

-1

c)

true

d)

none of these

5.

str1="6/4";

printf("str1");

a)

6/4

b)

str1

c)

None

6.

What is the main drawback of pointers

a)

Complexity to mange pointers

b)

Difficult to write program

c)

They are not safe

7.

Which of the following pointers leads to memory leaks

a)

Wild Pointers

b)

Dangling Pointers

c)

NULL Pointers

d)

Generic Pionters

8.

What is the output of the following code:


char *p="Welcome to GEC";

printf("%s",p+10);

a)

GEC

b)

to GEC

c)

It prints Memory address

d)

Invalid syntax of printf

9.

In C language Strings are _______________

a)

Mutable

b)

Immutable

c)

Both Mutable and Immutable

d)

No Mutable and immutable concept in C

10.

What is the output of the following code snippet:


char s[]="Ismart Shankar";

printf("%s",3+s+4);

a)

Shankar

b)

t Shankar

c)

Error

d)

art Shankar