NEW
Font size
WorksheetsCODE 4 KITSW ROUND – 3
Total questions: 25
Worksheet time: 8mins
What does "Character Arrays" refer to in programming?
A) A collection of characters arranged in a row
B) A collection of numbers arranged in a row
C) A collection of functions arranged in a row
D) A collection of objects arranged in a row
What is the output of the following code snippet?
int main() {
char str1[20] = "BeginnersBook";
printf("%d %d ", strnlen(str1, 30),strnlen(str1, 10));
}
30 10
10 13
13 10
None of the above
What is the output of the following code snippet?
int main() {
char s1[20] = "BeginnersBook";
char s2[20] = "BeginnersBook.COM";
printf("%d",strncmp(s1, s2, 8));
}
1
Not Equal
0
ERROR
What is the output of the following code snippet?
int main() {
char s1[10] = "Hello";
char s2[10] = "World";
strncat(s1,s2, 3);
printf("%s", s1);
}
HelloWor
Hello World
HelWor
HelloWorld
What is the output of C Program with arrays.?
int main() {
char str[25];
scanf("%s", str);
printf("%s",str);
return 0;
} //input: South Africa
South
South Africa
S
Compiler error
How are storage classes used to manage memory in C programming?
Allocate and deallocate memory dynamically
Define data types for variables
Control variable scope and lifetime
Store data temporarily during program execution
What is the Format specifier used to print a String or Character array in C Printf or Scanf function.?
%c
%C
%s
%w
What is the output of the following code snippet?
int main() {
char s1[30] = "string 1";
char s2[30] = "string 2 : I’m gonna copied into s1";
strcpy(s1,s2);
printf("String s1 is: %s", s1);
}
String s1 is: string 1
string 1
String s1 is: string 2 : I’m gonna copied into s1
String are immutual.
Which category of functions allows passing arguments and returns a value?
Functions with no arguments
Functions without return values
Functions with arguments but no return value
Functions with arguments and return values
What will be the output of the following C code snippet?
int main() {
char mystr[30] = "I’m an example of function strchr";
printf ("%s", strchr(mystr, 'f'));
}
I’m an example of
I’m an example of f
f function strchr
None of the Above
How do you convert this char array to string.?
char str[]={'x','y','z','b','a'};
str[5] = 0;
str[5] = '\0'
str[]={'x','y','z','b','a','\0'};
All the above
What is the primary advantage of recursion in programming?
Simplifies code execution
Reduces memory usage
Solves complex problems efficiently
Speeds up program execution
What is the output of C program with strings.?
int main() {
char str1[]="TECHNICAL CLUB";
char str2[20];
str2= str1; printf("%s",str2);
return 0;
}
TECHNICAL CLUB
T
TECHNICAL CLUB\0
Compiler error
What is the output of C Program with Strings.?
int main() {
char str[]={'x','y','z','a','b'};
printf("%s",str);
return 0;
}
x
xyzab
xyzab\0
None of the above
What do storage classes determine in programming?
The size of data types
The scope and lifetime of variables
The visibility of functions
The order of function execution
What is the maximum length of a C String.?
32 characters
64 characters
256 characters
None of the above
What will be the output of the program If characters 'a', 'b' and 'c' enter are supplied as input?
#include <stdio.h>
int main() {
void fun();
fun();
printf("\n");
return 0;
}
void fun() {
char c;
if((c = getchar())!= '\n')
fun();
printf("%c", c);
}
abc abc
bca
Infinite loop
cba
When working with strings, which function is used to read strings from user input?
write_string()
read_string()
input_string()
get_string()
How do you compare two strings in C programming language?
str1 == str2
str1[] == str2[]
strcmp(str1, str2)
strcmp(str1[], str2[])
How are strings terminated in C programming language?
NULL value
Tab value
End of File (EOF)
Space value
What is the primary use of character arrays in programming?
A) Storing numeric values
B) Storing text data
C) Storing boolean values
D) Storing complex objects
What does a "table of strings" typically store in programming?
A) Numeric values
B) Character sequences
C) Function pointers
D) Object references
What is the role of string handling functions in C programming?
A) Manipulating integer values
B) Formatting output data
C) Processing character arrays
D) Sorting data structures
What is the key benefit of using user-defined functions in programming?
A) Improved program efficiency
B) Reduced code complexity
C) Enhanced security features
D) Increased memory allocation
What is the output of C Program with String Arrays.?
int main(){
char p[] = "GODZILLA";
int i=0;
while(p[i] != '\0'){
printf("%c",*(p+i)); i++;
}
}
G
GODZILLA
Compiler error
None of the above
