Search Header Logo

Challenging C Programming Concepts

Authored by REVATHI R

Computers

University

Used 1+ times

Challenging C Programming Concepts
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code: int a = 10; int *p = &a; printf('%d', *p);?

20

*p

10

10.0

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following correctly allocates memory for an array of 10 integers?

int array(10);

int array[10];

int array[] = new int[10];

int[10] array;

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the result of the expression: sizeof(arr) / sizeof(arr[0]) if arr is an array of integers?

total memory allocated for arr

size of the array in bytes

size of the first element in bytes

number of elements in arr

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you declare a pointer to a function that takes an int and returns void?

void pointerName(int);

int *pointerName(void);

void (*pointerName)(int);

void (*pointerName)(void);

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the purpose of the 'free' function in C?

To allocate memory on the stack.

To deallocate memory previously allocated on the heap.

To read data from a file.

To initialize variables in C.

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following statements correctly initializes a string in C?

char* str = "Hello, World!";

string str = "Hello, World!";

char str = 'Hello, World!';

char* str = Hello, World!;

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code: char str[] = 'Hello'; printf('%c', str[1]);?

e

H

l

o

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?