Search Header Logo

C Programming Challenge for Students

Authored by Kaustubh Pandey

Others

1st Grade

Used 3+ times

C Programming Challenge for Students
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a pointer in C?

A pointer is a variable that stores a string in C.

A pointer is a special kind of loop in C.

A pointer is a type of function in C.

A pointer is a variable that holds the address of another variable in C.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you declare a pointer variable?

int *ptr;

*int ptr;

pointer int ptr;

int ptr;

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the 'malloc' function?

To create a new thread in a program.

To initialize variables to zero.

To allocate memory dynamically.

To free up memory after use.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you free dynamically allocated memory?

Use 'free(pointer)' for malloc/calloc/realloc and 'delete pointer' for new.

Use 'dispose(pointer)' for malloc/calloc/realloc

Invoke 'clear(pointer)' to free memory

Call 'remove(pointer)' for new allocations

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between 'fopen' and 'fclose'?

'fopen' opens a file; 'fclose' closes a file.

'fopen' opens a directory; 'fclose' opens a file.

'fopen' deletes a file; 'fclose' creates a file.

'fopen' reads a file; 'fclose' writes to a file.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you read data from a file in C?

Use read() to directly access the file contents.

Use file_get_contents() to read the entire file at once.

Use fopen() to open the file, then read with fscanf() or fgets(), and close with fclose().

Open the file with open() and read using readlines().

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a structure in C?

A structure in C is a way to define constants.

A structure in C is a function that performs calculations.

A structure in C is a user-defined data type that groups different data types together.

A structure in C is a built-in data type for integers.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?