0
0
Cprogramming~20 mins

What is C - Practice Questions & Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
C Language Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary use of the C programming language?

Which of the following best describes the main purpose of the C programming language?

AA scripting language used for automating tasks.
BA high-level language mainly used for web development.
CA low-level language used for system programming and embedded systems.
DA language designed exclusively for database management.
Attempts:
2 left
💡 Hint

Think about what kind of programs need direct hardware access and efficiency.

Predict Output
intermediate
1:00remaining
Output of a simple C program

What is the output of the following C program?

C
#include <stdio.h>

int main() {
    int a = 5, b = 3;
    printf("%d\n", a + b);
    return 0;
}
A8
B53
C0
DError: invalid syntax
Attempts:
2 left
💡 Hint

Remember that the + operator adds numbers, not concatenates them.

Predict Output
advanced
1:30remaining
What is the output of pointer manipulation?

What will this C program print?

C
#include <stdio.h>

int main() {
    int x = 10;
    int *p = &x;
    *p = 20;
    printf("%d\n", x);
    return 0;
}
ACompilation error
BAddress of x
C10
D20
Attempts:
2 left
💡 Hint

Changing the value pointed to by p changes x.

🔧 Debug
advanced
1:30remaining
Identify the error in this C code snippet

What error will this C code produce?

C
#include <stdio.h>

int main() {
    int arr[3] = {1, 2, 3};
    printf("%d\n", arr[3]);
    return 0;
}
AUndefined behavior (accessing out of bounds)
BCompilation error
CPrints 3
DPrints 0
Attempts:
2 left
💡 Hint

Array indices start at 0 and go up to size-1.

🧠 Conceptual
expert
2:00remaining
Why is C considered a 'portable' language?

Which reason best explains why C is called a portable programming language?

ABecause C code can run without any changes on all hardware architectures.
BBecause C compilers exist for many platforms, allowing code to be recompiled easily.
CBecause C programs do not use any hardware-specific features.
DBecause C automatically translates code to machine language for any device.
Attempts:
2 left
💡 Hint

Think about how code moves between different computers.