MVJ21CS13 Assignment 3
MVJ21CS13 Assignment 3
MVJ21CS13 Assignment 3
Write the answers for each question in A4 sheet and submit before the deadline
CO Code Course Outcomes
CO1 · Familiarize with writing of algorithms, fundamentals of C and philosophy of problem
solving.
CO Learning
Code Level
a. What is a data structure? Why is an array called a data CO1 L2
structure?
1
b. What is an array? Explain one dimensional and two
dimensional array in detail?
a. Why is sorting and searching is important? CO1 L3
2
b. Explain binary search and bubble sort with an example
a. What happens when an array with specified size is assigned? CO1 L4
3 A. with values fewer than the specified size.
B. with values more than the specified size.
4 a. Explain multi dimensional array and dynamic array in detail. CO1 L5
b. Identify the errors, if any , in each of the following array
declaration statements
1. int score(100);
2. float value[10,15];
3. char name[15];
4. double salary[i+ROW];
5. int sum[];
6. int number[ ]={0,0,0,0,0,0};
7. float item[3][2]={0,1,2,3,4,5};
8. char word[]={‘a’,’r’,’r’,’a’,’y’};
9. float result[10]=0;
10. char str1[4]=”GOOD”;
a. How to declare, initialize and access the string variables give CO1 L2
5 an example
b. Explain writing and reading strings from and to the terminal
a. What is the need of string handling functions? Discuss all the CO1 L1
string handling functions in brief with examples.
6
b. What are the other string functions used to manipulate the
string functions
a. Which of the following statements will correctly store the CO2 L5
concatenation of strings s1 and s2 in string s3?
a. s3=strcat(s1,s2);
b. strcat(s1,s2,s3);
8
c. strcat(s3,s2,s1);
d. strcpy(s2,strcat(s2,s2));
e. strcmp(s2,strcat(s1,s2));
f. strcpy(strcat(s1,s2),s3);
a. Find errors, if any, in the following code segments CO2 L4
a. char str[]
strncpy(str,”GOD”,3)
printf(“%s”,str);
b. char str[10];
9 strcpy(str,”balaguruswamy”);
c. if strstr(“balaguruswamy”, “guru”)==0);
printf(substring is found”);
d. chars1[5], s2[10];
gets(s1,s2);