NEW
Font size
WorksheetsComputer Science Quiz
Total questions: 15
Worksheet time: 8mins
What is an array in programming?
C. A data structure that can only store integers
D. A type of loop in programming
B. A fixed-size sequenced collection of elements of the same data type
A. A variable that can store multiple data types
How can arrays be initialized?
D. Arrays cannot be initialized
B. Only at run time
A. Only at compile time
C. Both at compile time and run time
What is the difference between character arrays and strings?
B. Character arrays are stored in the String Constant Pool
A. Character arrays are immutable, strings are mutable
D. Character arrays have built-in methods to perform operations
C. Strings can be converted to character arrays using toCharArray() method
What is the syntax for defining a function with arguments and return value?
D. int function()
C. void function()
B. int function(int x)
A. void function(int x)
What is the purpose of the checkPrimeNumber function in the C program?
D. To convert a string to a character array
C. To calculate the Fibonacci series
B. To check if a number is prime
A. To swap two integers
What is the difference between Call by Value and Call by Reference?
C. Call by Value allows altering the values of actual variables
B. Call by Reference copies the values of variables
A. Call by Value uses pointer variables
D. Call by Reference is preferred for passing small values
What is recursion in programming?
A. The process of repeating items in a self-similar way
B. The process of swapping variables
C. The process of converting strings to arrays
D. The process of defining multiple functions
How can arrays be passed to a function?
B. Only as a sized array
A. Only as a pointer
C. Only as an unsized array
D. All of the above
What is the output of the Fibonacci program in the C code?
A. 0 1 1 2 3 5 8 13 21 34
D. 1 3 5 7 9 11 13 15 17 19
B. 1 2 3 5 8 13 21 34 55 89
C. 0 1 1 2 3 5 8 13 21 29
What is the purpose of the Strfun function in the C program?
D. To define a recursive function
C. To calculate prime numbers
B. To pass a string to a function
A. To declare a buffer of type char
When is Call by Value preferred over Call by Reference?
D. When using pointer variables
A. When passing a large amount of data
B. When altering the values of variables
C. When passing small values that should not change
What is the purpose of the getchar function in programming?
A. To check if a number is prime
C. To store passwords in character arrays
D. To return an integer representing a character
B. To convert a string to a character array
What is the general form of initializing arrays at compile time?
C. void function(int x)
D. int j, flag = 1
B. int n1, n2, i, flag
A. float total[5] = {0.0,15.75,-10}
What is the purpose of the C program to display prime numbers between intervals?
C. To check if a number is prime
D. To pass strings to a function
B. To calculate the Fibonacci series
A. To swap two positive integers
What is the difference between one dimensional arrays and character arrays?
D. One dimensional arrays have built-in methods to perform operations
C. Character arrays can be converted into strings
B. One dimensional arrays are stored in the Heap
A. One dimensional arrays are mutable, character arrays are immutable
