Batch 2_Updated

Batch 2_Updated

University

30 Qs

quiz-placeholder

Similar activities

Stack and Queue

Stack and Queue

University

25 Qs

String in C Programming

String in C Programming

University

26 Qs

Compro. Final1/64 part2

Compro. Final1/64 part2

University

25 Qs

IPC144 - Week 3

IPC144 - Week 3

University

28 Qs

Final Exam - BECC0302

Final Exam - BECC0302

University

35 Qs

Computer Programming 1 Review

Computer Programming 1 Review

University

30 Qs

 Milking Minds 17-01-24

Milking Minds 17-01-24

University

25 Qs

CODE JAM

CODE JAM

KG - University

25 Qs

Batch 2_Updated

Batch 2_Updated

Assessment

Quiz

Computers

University

Easy

Created by

Arunsundar Balasubramanian

Used 1+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary difference between static keyword used inside a function and outside a function (at file scope)?

Inside a function, it makes the variable constant; outside, it limits visibility to the current file.

Inside a function, it preserves the variable's value between calls; outside, it limits visibility to the current file.

Inside a function, it makes the variable accessible only within the function; outside, it makes the variable global.

Inside a function, it makes the variable thread-safe; outside, it makes the variable read-only.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider this code: int *ptr = malloc(10 * sizeof(int));. What is the most likely problem if malloc fails?

The program will crash immediately.

ptr will be a null pointer.

ptr will point to garbage memory.

The program will compile with a warning.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to deallocate memory allocated with calloc?

free(calloc_ptr);

dealloc(calloc_ptr);

free(calloc_ptr, size); (where size is the allocated size)

delete calloc_ptr;

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a potential issue with using gets()?

It's slow.

It can cause a buffer overflow.

It can only read strings of a fixed length.

It's deprecated but still safe to use if you're careful.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this code snippet? #include int main() { int arr[] = {1, 2, 3, 4, 5}; int *ptr = arr; printf("%d\n", *(ptr + 2)); return 0; }

1

2

3

4

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is NOT a standard C header file?

stdio.h

string.h

iostream.h

math.h

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does volatile keyword signify in C?

The variable's value will not be changed.

The variable might be changed by something outside the program's control.

The variable will be stored in a register.

The variable is thread-safe.

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?