Search Header Logo
Functions

Functions

Assessment

Presentation

Computers

University

Practice Problem

Hard

Created by

Supriya Singh

FREE Resource

52 Slides • 26 Questions

1

media

2

media

3

Open Ended

How do you think parameter passing by value and by reference might affect the behavior of a function in C?

4

Multiple Choice

Why is understanding functions important in C programming?

1

Because functions help organize code and make it reusable

2

Because functions slow down the program

3

Because functions are only used in advanced programming

4

Because functions are not necessary in C

5

media

6

media

7

Multiple Choice

Which of the following is NOT a part of a function in C programming?

1

Function Prototypes

2

Function Calls

3

Function Definitions

4

Function Parameters

8

media

9

media

10

media

11

Fill in the Blanks

Type answer...

12

Multiple Select

Select all the correct statements about function prototypes in C.

1

A function prototype tells the compiler the function specifications.

2

A function prototype is optional in C programming.

3

The syntax for a function prototype includes the return type, function name, and parameter list.

4

Function prototypes must be placed after the main function.

13

media

14

Multiple Choice

What are the two ways to invoke functions in programming languages as described in the slides?

1

Call by Value and Call by Reference

2

Call by Pointer and Call by Address

3

Call by Name and Call by Type

4

Call by Function and Call by Procedure

15

media

16

media

17

Multiple Choice

Which of the following best describes the difference between 'Call By Value' and 'Call By Reference' in C functions?

1

Call By Value copies the value, Call By Reference copies the address

2

Call By Value copies the address, Call By Reference copies the value

3

Both copy the value

4

Both copy the address

18

media

19

Open Ended

Explain how the return statement works in a C function. Provide an example.

20

media

21

Fill in the Blanks

Type answer...

22

Multiple Choice

Which math library function would you use to calculate the absolute value of a variable in C?

1

sqrt(x)

2

abs(x)

3

pow(x,y)

4

log(x)

23

media

24

Multiple Select

Select all statements that are true about the sample add function in C.

1

It uses a function prototype.

2

It takes two integer arguments.

3

It returns the sum of two integers.

4

It prints the result inside the function definition.

25

media

26

Open Ended

Describe the purpose of using an array as a parameter in the Fibonacci series function in C.

27

media

28

Multiple Select

Which of the following are true about the Fibonacci series program shown?

1

It uses recursion to generate the series.

2

It initializes the first two elements of the array.

3

It prints the Fibonacci series using a loop.

4

It uses a while loop for iteration.

29

media

30

Fill in the Blanks

Type answer...

31

media

32

Multiple Choice

Which statement best describes what happens when an array is passed as an argument to a function in C?

1

A copy of the entire array is passed to the function.

2

Only the address of the array is passed to the function.

3

Both the address and a copy of the array are passed.

4

The function cannot access the array elements.

33

media

34

Multiple Choice

What is the output of the display function when called with an array initialized as t[i]=i for i from 0 to 9?

1

It prints the squares of the indices.

2

It prints the values from 0 to 9.

3

It prints only the first value of the array.

4

It prints the values from 1 to 10.

35

media

36

media

37

Open Ended

Compare and contrast the use of recursion and iteration in calculating mathematical series, using the factorial and Fibonacci examples provided.

38

Open Ended

Explain how recursion is used to calculate the factorial of a number in C, referring to the code provided.

39

media

40

Multiple Choice

What is the purpose of the 'power' function in the given C code?

1

To add two numbers

2

To multiply two numbers

3

To calculate the power of a number

4

To divide two numbers

41

media

42

Open Ended

Explain how recursion is used in the implementation of the 'power' function.

43

media

44

Multiple Select

Which of the following are storage classes in C?

1

auto

2

extern

3

register

4

static

45

media

46

Fill in the Blanks

Type answer...

47

media

48

Open Ended

Describe the difference between a compound statement with declarations and one without declarations in C programming.

49

media

50

Multiple Choice

What will be the output of the following code snippet? main() { {auto int c = 5; printf("\nThe first value of c is %d", c); } { printf("\nThe second value of c is %d", c); } return 0; }

1

The first value of c is 5 The second value of c is 5

2

The first value of c is 5 The second value of c is garbage value

3

Compilation error

4

The first value of c is 5 The second value of c is 0

51

media

52

media

53

media

54

media

55

media

56

media

57

media

58

media

59

media

60

media

61

media

62

media

63

media

64

media

65

media

66

media

67

media

68

media

69

media

70

media

71

media

72

media

73

media

74

media

75

media

76

media

77

Open Ended

After learning about C functions, what is one area you would like to explore further or still have questions about?

78

Multiple Choice

What are the main topics covered in this chapter about C functions?

1

Function definitions, function declarations, function calls, functions that return values, functions with parameters

2

Loops, arrays, and pointers

3

File handling and memory management

4

Object-oriented programming concepts

media

Show answer

Auto Play

Slide 1 / 78

SLIDE