C-Volution (Intermediate)

C-Volution (Intermediate)

University

20 Qs

quiz-placeholder

Similar activities

C++ Functions Quiz

C++ Functions Quiz

University

23 Qs

Minigame CLB Tin học 20/10

Minigame CLB Tin học 20/10

University

15 Qs

DSA (QUIZ 6) Hashing, Graphs, Advanced Graph Algorithms, and DP

DSA (QUIZ 6) Hashing, Graphs, Advanced Graph Algorithms, and DP

University

20 Qs

Java Programming Quiz 1

Java Programming Quiz 1

University

25 Qs

Циклы и массивы

Циклы и массивы

University

20 Qs

Java Basics, operators and variables (CH/PT)

Java Basics, operators and variables (CH/PT)

University

16 Qs

CMDP2063 Unix and C Programming (Revision)

CMDP2063 Unix and C Programming (Revision)

University

15 Qs

Квіз з роботи з файлами в мові C

Квіз з роботи з файлами в мові C

University

21 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?