wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

CODE 4 KITSW ROUND – 3

Total questions: 25

Worksheet time: 8mins

Name
Class
Date
1.

What does "Character Arrays" refer to in programming?

a)

A) A collection of characters arranged in a row

b)

B) A collection of numbers arranged in a row

c)

C) A collection of functions arranged in a row

d)

D) A collection of objects arranged in a row

2.

What is the output of the following code snippet?

int main() {

char str1[20] = "BeginnersBook";

printf("%d %d ", strnlen(str1, 30),strnlen(str1, 10));

}

a)

30 10

b)

10 13

c)

13 10

d)

None of the above

3.

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));

}

a)

1

b)

Not Equal

c)

0

d)

ERROR

4.

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);

}

a)

HelloWor

b)

Hello World

c)

HelWor

d)

HelloWorld

5.

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

a)

South

b)

South Africa

c)

S

d)

Compiler error

6.

How are storage classes used to manage memory in C programming?

a)

Allocate and deallocate memory dynamically

b)

Define data types for variables

c)

Control variable scope and lifetime

d)

Store data temporarily during program execution

7.

What is the Format specifier used to print a String or Character array in C Printf or Scanf function.?

a)

%c

b)

%C

c)

%s

d)

%w

8.

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);

}

a)

String s1 is: string 1

b)

string 1

c)

String s1 is: string 2 : I’m gonna copied into s1

d)

String are immutual.

9.

Which category of functions allows passing arguments and returns a value?

a)

Functions with no arguments

b)

Functions without return values

c)

Functions with arguments but no return value

d)

Functions with arguments and return values

10.

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'));

}

a)

I’m an example of

b)

I’m an example of f

c)

f function strchr

d)

None of the Above

11.

How do you convert this char array to string.?

char str[]={'x','y','z','b','a'};

a)

str[5] = 0;

b)

str[5] = '\0'

c)

str[]={'x','y','z','b','a','\0'};

d)

All the above

12.

What is the primary advantage of recursion in programming?

a)

Simplifies code execution

b)

Reduces memory usage

c)

Solves complex problems efficiently

d)

Speeds up program execution

13.

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;

}

a)

TECHNICAL CLUB

b)

T

c)

TECHNICAL CLUB\0

d)

Compiler error

14.

What is the output of C Program with Strings.?

int main() {

char str[]={'x','y','z','a','b'};

printf("%s",str);

return 0;

}

a)

x

b)

xyzab

c)

xyzab\0

d)

None of the above

15.

What do storage classes determine in programming?

a)

The size of data types

b)

The scope and lifetime of variables

c)

The visibility of functions

d)

The order of function execution

16.

What is the maximum length of a C String.?

a)

32 characters

b)

64 characters

c)

256 characters

d)

None of the above

17.

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);

}

a)

abc abc

b)

bca

c)

Infinite loop

d)

cba

18.

When working with strings, which function is used to read strings from user input?

a)

write_string()

b)

read_string()

c)

input_string()

d)

get_string()

19.

How do you compare two strings in C programming language?

a)

str1 == str2

b)

str1[] == str2[]

c)

strcmp(str1, str2)

d)

strcmp(str1[], str2[])

20.

How are strings terminated in C programming language?

a)

NULL value

b)

Tab value

c)

End of File (EOF)

d)

Space value

21.

What is the primary use of character arrays in programming?

a)

A) Storing numeric values

b)

B) Storing text data

c)

C) Storing boolean values

d)

D) Storing complex objects

22.

What does a "table of strings" typically store in programming?

a)

A) Numeric values

b)

B) Character sequences

c)

C) Function pointers

d)

D) Object references

23.

What is the role of string handling functions in C programming?

a)

A) Manipulating integer values

b)

B) Formatting output data

c)

C) Processing character arrays

d)

D) Sorting data structures

24.

What is the key benefit of using user-defined functions in programming?

a)

A) Improved program efficiency

b)

B) Reduced code complexity

c)

C) Enhanced security features

d)

D) Increased memory allocation

25.

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++;

}

}

a)

G

b)

GODZILLA

c)

Compiler error

d)

None of the above