NEW
Font size
WorksheetsCPR_Quiz_Arrays and strings
Total questions: 20
Worksheet time: 28mins
What is right way to Initialize array?
int num[6] = { 2, 4, 12, 5, 45, 5 };
int n{} = { 2, 4, 12, 5, 45, 5 };
int n{6} = { 2, 4, 12 };
int n(6) = { 2, 4, 12, 5, 45, 5 };
An array elements are always stored in ________ memory locations.
sequential
Random
Sequential and Random
None of the above
what will be printed after Execution of the following program
void main()
{
int a[5]={11,13,56,20,5};
printf("%d",a[2]);
}
garbage value
13
56
20
if two strings are identical then function strcmp() returns
0
-1
true
none of these
what will be the output of the program?
#include <stdio.h>
#include<string .h>
void main()
{
char str1[20]="Hello",str2="world";
strcat(str1,str2);
puts(str1);
return 0;
}
Hello
world
Helloworld
none of the above
8.Which of the following correctly accesses the seventh element stored in arr, an array with 100 elements?
arr[6]
arr[7]
arr{6}
arr{7}
string concatenation means?
combining two strings.
Extracting a sub string out of a string.
Partitioning the string into two strings.
Merging two strings.
What is a String in C Language.?
String is a new Data Type in C
String is an array of Characters with null character as the last element of array.
String is an array of Characters with null character as the first element of array
String is an array of Integers with 0 as the last element of array
What is the output of C Program with Strings.?
int main()
{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}
g
globe
globe\0
None of the above
An array Index starts with.?
-1
0
1
2
What is the output of C Program.?
int main()
{
int a[] = {1,2,3,4};
int b[4] = {5,6,7,8};
printf("%d,%d", a[0], b[0]);
}
1,5
2,6
0 0
Compiler error
What is the output of C program with arrays.?
int main()
{
int a[3] = {20,30,40};
int b[3];
b=a;
printf("%d", b[0]);
}
20
30
address of 0th element.
Compiler error
What is an Array in C language.?
A group of elements of same data type.
An array contains more than one element
Array elements are stored in memory in continuous or contiguous locations.
All the above.
What is the output of C Program with arrays.?
int main()
{
int rollno[3]=[1001,1002,1003];
printf("%d", rollno[1]);
}
1002
1003
address of 1002
Compiler error
What is the minimum and maximum Indexes of this below array.?
int main()
{
int ary[9];
return 0;
}
-1, 8
0, 8
1,9
None of the above
What is the dimension of the below C Array.?
int ary[]={1,3,5,7};
1
2
3
5
What is the dimension of the C array int ary[10][5].?
1
2
5
10
Which of the following function is more appropriate for reading in a multi-word string?
scanf()
printf()
puts()
gets()
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 meaning of following declaration ?
int arr[20];
None of these
Array of Size 20
Integer Array of size 20
Array of size 20 that can have integer address
