C programming skills for a junior embedded software developer to prepare for a job interview Flashcards
(77 cards)
What is the purpose of the ‘main’ function in a C program?
The ‘main’ function is the entry point of a C program where execution starts.
True or False: In C, a pointer is a variable that stores the memory address of another variable.
True
Fill in the blank: The standard library function used to allocate memory dynamically in C is called _____ .
malloc
Which of the following is a correct way to declare an integer pointer in C? (a) int p; (b) int *p; (c) pointer int p;
(b) int *p;
What does the ‘volatile’ keyword indicate when used in a variable declaration?
It indicates that the variable may be changed by something outside the control of the program, preventing the compiler from optimizing it.
What does ‘C’ stand for in the C programming language?
The letter ‘C’ does not stand for anything; it is simply the name of the programming language.
True or False: C is a high-level programming language.
True
Fill in the blank: The __________ operator is used to access members of a structure in C.
dot
What is the purpose of a pointer in C?
A pointer is used to store the address of another variable.
Which of the following is a valid variable declaration in C? (a) int 1number; (b) float number1; (c) char @name;
b) float number1;
What is the output of the following code: printf(‘%d’, 5 + 3);?
8
What does ‘malloc’ function do in C?
It allocates a specified amount of memory during runtime.
True or False: C supports function overloading.
False
What is the purpose of the ‘return’ statement in a function?
It ends the function and optionally returns a value to the caller.
Fill in the blank: The __________ statement is used to create a loop that continues until a specified condition is false.
while
What is an array in C?
An array is a collection of variables of the same type stored in contiguous memory locations.
What is the correct syntax to declare a function in C?
return_type function_name(parameter_type parameter_name) { /* function body */ }
True or False: In C, a string is an array of characters terminated by a null character.
True
What is the purpose of the ‘typedef’ keyword in C?
It is used to create an alias for an existing data type.
Which of the following is the correct way to comment a single line in C? (a) // comment (b) /* comment */ (c) # comment
a) // comment
What is the significance of the ‘main’ function in a C program?
It is the entry point of the program where execution begins.
Fill in the blank: The __________ function is used to read input from the user in C.
scanf
What does the ‘break’ statement do in a loop?
It terminates the loop and transfers control to the statement following the loop.
True or False: In C, all variables must be declared before they are used.
True