NEW
Font size
WorksheetsC CODE MASTER A
Total questions: 20
Worksheet time: 28mins
Which keyword is used to prevent any changes in the variable within a C program?
immutable
const
volatile
mutable
In C language what are the basic building blocks that are constructed together to write a program?
keywords
tokens
identifiers
functions
Which is the smallest program to compile and run without errors?
main() { ; }
main() { }
int main() {return 0;}
main()
In which segment does dynamic memory allocation takes place?
BSS Segment
data segment
heap
stack
By default c uses the call by value method to pass arguments to functions. How can you invoke the call by reference method?
by using recursive functions
by using pointers
by using global variables
by declaring functions separately from defining them
what is the output of following program.
B D
B C
A B
error
What is the output of following programe.
TRUE
FALSE
RUN TIME ERROR
COMPILATION ERROR
For 16-bit compiler allowable range for integer constant is ____
-32668 to 32667
-32767 to 32768
-32768 to 32767
-3.4e38 to 3.4e38
Which one of the following is not a reserved Keywords in C.
auto
main
case
default
none of these
What is the difference btw a declaration and definiton of a variable?
A definition occurs once, but a declaration may occur many times.
Both can occur multiple times, but a declaration must occur first.
Both can occur multiple times, but a definition must occur first
A declaration occurs once, but a definition may occur many times.
There is no difference between them
Which of the following is true about arrays in C.
For every type T, there can be an array of T.
For every type T except void and function type, there can be an array of T.
When an array is passed to a function, C compiler creates a copy of array.
2D arrays are stored in column major form
Which of the following is true :-
gets() doesn't do any array bound testing and should not be used.
gets() cannot read strings with spaces
fgets() should be used in place of gets() only for files, otherwise gets() is fine
None of the above
Which one of the following is correct for overloaded functions in C++ ?
Compiler sets up a separate function for every definition of function.
Compiler does not set up a separate function for every definition of function.
Overloaded functions cannot handle different types of objects.
Overloaded functions cannot have same number of arguments.
Which of the following is NOT possible with any 2 operators in C?
Same precedence, different associativity
Different precedence, different associativity
Different precedence, same associativity
All of the mentioned
The C-preprocessors are specified with ____ symbol.
*
%
#
" "
What will be the output of the following C function?
Segmentation fault
Compilation error
1 2 3 4 5
Undefined behaviour
Is it necessary that in a function which accepts variable argument list there should be at least be one fixed argument?
True
False
To scan a and b given below, which of the following scanf() statement will you use?
scanf("%f %lf", &a, b);
scanf("%Lf %Lf", &a, &b);
scanf("%f %Lf", &a, &b);
scanf("%f %lf", &a, &b);
Which of the following statement is correct prototype of the malloc() function in c ?
int* malloc(int);
char* malloc(char);
unsigned int* malloc(unsigned int);
void* malloc(size_t);
Iteration requires more system memory than recursion.
True
False
