NEW
Font size
WorksheetsARRAYS AND FUNCTIONS
Total questions: 15
Worksheet time: 8mins
Each element in an array can be accessed using its what?
By counting in the items in the array
Position or index in the array
By printing the items in the array
By printing and counting the entire array
Why are arrays useful?
It saves storage space storing under one name
You can store integers and strings together
You can store thing related on different topics
You may have lots of related data that you don't want to store separately
Which element is at index 1 in the array?
Pear
Apple
Orangle
Orange
What's the code doing here?
Changing the value of the element at index 2
Changing the value of the element at index 1
Changing the element of the value at index 1
Changing the index of the value
What would this code print?
Crumpet
Apple
Pork
Beef
Which of the following is true about return type of functions in C?
Functions can return any type
Functions can return any type except array and functions
Functions can return any type except array, functions and union
Functions can return any type except array, functions, function pointer and union
In C, what is the meaning of following function prototype with empty parameter list
void fun()
{
/* .... */
}
Function can only be called without any parameter
Function can be called with any number of parameters of any types
Function can be called with any number of integer parameters.
Function can be called with one integer parameter
What is the output of this C code?
int main()
{
void foo(), f();
f();
}
void foo()
{
printf("2 ");
}
void f()
{
printf("1 ");
foo();
}
Compile time error as foo is local to main
1 2
2 1
Compile time error due to declaration of functions inside main
What is the output of this C code?
int main()
{
int i = -5;
int k = i %4;
printf("%d\n", k);
}
Compile time error
-1
1
None
What is the value of x in this C code?
void main()
{
int x = 4 *5 / 2 + 9;
}
6.75
1.85
19
3
#include is called
Preprocessor directive
Inclusion directive
File inclusion directive
None of the mentioned
Which keyword can be used for coming out of recursion?
break
return
exit
Both (a) and (b)
