C-Volution (Intermediate)

C-Volution (Intermediate)

University

20 Qs

quiz-placeholder

Similar activities

DATA STRUCTUIR Quiz1 (AIML)

DATA STRUCTUIR Quiz1 (AIML)

University

20 Qs

Quiz de Programação em C

Quiz de Programação em C

University

17 Qs

Session 06: Loop

Session 06: Loop

University

18 Qs

Session 19: Pointer

Session 19: Pointer

University

17 Qs

Quiz Daspro Kom B 2024

Quiz Daspro Kom B 2024

University

15 Qs

Session 04: Branching statements

Session 04: Branching statements

University

15 Qs

NGP QUIZ 1

NGP QUIZ 1

University

15 Qs

Session 02

Session 02

University

15 Qs

C-Volution (Intermediate)

C-Volution (Intermediate)

Assessment

Quiz

Information Technology (IT)

University

Hard

Created by

Sujal Bhagat

Used 1+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What is the output of the following code #include int main() { int x = 5; int *p = &x; *p = *p + 10; printf("%d\n", x); return 0; }

5

10

15

Error

2.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Which of the following is NOT a valid way to dynamically allocate memory?

malloc()

calloc()

realloc()

alloc()

3.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What is the primary difference between malloc() and calloc()?

malloc() initializes allocated memory to zero, calloc() does not.

calloc() allocates memory for a single element, malloc() for multiple.

malloc() allocates memory in bytes, calloc() in number of elements.

There is no difference.

4.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What is a dangling pointer?

A pointer that points to a memory location that has been freed.

A pointer that has not been initialized.

A pointer that points to a null value.

A pointer that points to an invalid memory address.

5.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What is the output of the following code? #include int main() { char str[] = "Hello"; printf("%lu\n", sizeof(str)); return 0; }

5

6

7

Error

6.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

Which of the following is the correct way to declare a function pointer?

int (*func)(int, int);

int *func(int, int);

int func(int, int);

int *(func)(int, int);

7.

MULTIPLE CHOICE QUESTION

45 sec • 2 pts

What does the const keyword signify when used with a pointer?

The pointer cannot be changed.

The value pointed to by the pointer cannot be changed.

Both the pointer and the value pointed to cannot be changed.

It has no effect.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?