wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Programming Day-10

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

1. What is the correct function to calculate the square root of a number in C?

a)

sqrt()

b)

pow()

c)

sqr()

d)

root()

2.

What does the function pow(2, 3) return?

a)

5

b)

6

c)

7

d)

8

3.

Which of the following functions returns the absolute value of a number?

a)

mod()

b)

absval()

c)

fabs()

d)

abs()

4.

Which header file is needed for using ceil() and floor() functions?

a)

stdio.h

b)

stdlib.h

c)

math.h

d)

string.h

5.

What does floor(3.8) return?

a)

4.0

b)

3.5

c)

3.8

d)

3.0

6.

What does strlen("hello") return?

a)

5

b)

4

c)

Error

d)

6

7.

Which function is used to copy one string into another?

a)

strcat()

b)

strcpy()

c)

strlen()

d)

strrev()

8.

What is the output of strcmp("abc", "abc")?

a)

1

b)

0

c)

-1

d)

Error

9.

What does strcat("Hello", "World") do?

a)

Joins the strings and stores in the first string's memory

b)

Throws an error

c)

Compares the strings

d)

Joins the strings and stores in a new variable

10.

Which function is used to find a substring in a string?

a)

strchr()

b)

strstr()

c)

strlen()

d)

strcpy()