Unit 4 : Function 2

Unit 4 : Function 2

University

8 Qs

quiz-placeholder

Similar activities

Weekly Contest #8 - TechXNinjas

Weekly Contest #8 - TechXNinjas

University

10 Qs

S02 - Deep Learning

S02 - Deep Learning

University

10 Qs

JavaScript Quiz

JavaScript Quiz

University

12 Qs

OFDP-73/120 Assignment 1

OFDP-73/120 Assignment 1

University

10 Qs

C Programming Lab Quiz

C Programming Lab Quiz

University

10 Qs

Functions C

Functions C

University

10 Qs

H -Subprograms

H -Subprograms

12th Grade - University

12 Qs

C++ Workshop 2021 [Quiz-2]

C++ Workshop 2021 [Quiz-2]

University

10 Qs

Unit 4 : Function 2

Unit 4 : Function 2

Assessment

Quiz

Computers

University

Medium

Created by

Norhamimi Hamdan

Used 1+ times

FREE Resource

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'main' function in a C program?

To execute loops

To define global variables

To serve as the entry point of the program

To declare functions

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to call a function named 'first'?

first{}

call first;

execute first;

first();

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for defining a function in C?

return_type function_name(parameters) { // body }

function_name(parameters) { // body }

function_name return_type(parameters) { // body }

function_name(parameters) return_type { // body }

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between function arguments and parameters?

Arguments are always integers, parameters can be any type

There is no difference

Parameters are declared in the definition function, arguments are passed to it

Arguments are declared in the function, parameters are passed to it

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What type of variable can be accessed by all functions in a program?

Dynamic variable

Static variable

Global variable

Local variable

6.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

Determine local variable?

declare outside the functions

declare inside the function body

All function can use

the variable only can be use inside the function body.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a recursive function?

A function that is defined inside another function

A function that cannot return a value

A function that calls itself

A function that calls another function

8.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What will be the output for the following programming code:

#include <stdio.h>

display(int n);

int main() {

display(3);

return 0;

}

display(int n){

printf("%d ", n);

if(n <= 1)

{

return;

}

display(n - 1);

}

1

123

321

1122