WorksheetsCodigo
Total questions: 15
Worksheet time: 11mins
What is the output of the following code?
int main()
{
int x = 10, y = 5;
printf("%d", x + y * 2);
return 0;
}
30
20
25
15
What is the difference between ++i and i++ in C?
Both increment the value by 1 but ++i increments before the value is used, and i++ increments after.
Both increment the value by 1, but ++i increments after the value is used, and i++ increments before.
++i increases by 2, and i++ increases by 1.
There is no difference.
What will be the value of i after the following loop?
int i;
for(i = 0; i < 10; i++) {
if (i == 5) {
break;
} }
4
5
10
9
What does the static keyword do in C?
It makes a variable visible throughout the program.
It makes a function visible only within its file.
It ensures that a variable retains its value between function calls.
It makes a variable constant.
Who is known as the father of the computer?
Alan Turing
Charles Babbage
John Von Neumann
Bill Gates
Who invented the concept of the first programmable computer?
John Atanasoff
Charles Babbage
Alan Turing
Konrad Zuse
Who is known for developing the first successful theory of artificial intelligence(AI)?
Alan Turing
John McCarthy
Marvin Minsky
Claude Shannon
What is the difference between malloc and calloc in C?
malloc initializes memory, but calloc does not.
calloc allocates memory for a single object, but malloc allocates for multiple objects.
malloc initializes memory with 0, but calloc does not.
malloc allocates memory, but calloc allocates and initializes memory to 0.
What will be the output of this code?
int x = 5;
printf("%d %d %d", x++, ++x, x++);
5 7 6
6 7 6
5 6 6
5 7 7
What are function pointers in C, and how are they used?
Function pointers store the address of a function, which can be invoked later.
Function pointers are used to declare multiple functions at once.
Function pointers store the return value of functions.
Function pointers are used for defining arrays of functions.
How do you prevent a function from returning a value in C?
Use the void return type.
Use the null return type.
Use the none return type.
Use the no-return keyword.
What is the purpose of the const keyword in C?
It prevents the variable from being modified.
It makes a variable read-only during compilation.
It makes a function return only constant values.
It allows you to define constant values at runtime.
What will be the result of the following code?
int a = 5, b = 5;
printf("%d", a == b ? 10 : 20);
20
null
10
Error
What will the following Python code output?
a = 3
b = 2
print(a ** b)
6
9
8
5
What will be the output of this code?
int x = 10;
printf("%d", x & 3);
10
3
2
0
