Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

ODD 2020

Tutorial Sheet - 9
Software Development Fundamentals – I (15B11CI111)

Course Outcomes (CO)

CO1 Explain various phases of software development life cycle

Explain various data types, memory allocation schemes, precedence of


CO2
arithmetical and logical operations, and need of array, and structures

CO3 Draw the flow chart and write the high level code for different problems

CO4 Apply and implement functions with or without pointers for different problems

Demonstrate and implement various operations like traverse, insertion, deletion,


CO5
etc. on files

Q1. [CO2] Predict output of the following program:


int main()
{
int a[][] = {{1,2},{3,4}};
int i, j;
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
printf("%d ", a[i][j]);
return 0;
}

Q2. [CO2] Consider the C program given below :


#include <stdio.h>
int main () {
int sum = 0, maxsum = 0, i, n = 6;
int a [] = {2, -2, -1, 3, 4, 2};
for (i = 0; i < n; i++) {
if (i == 0 || a [i] < 0 || a [i] < a [i - 1]) {
if (sum > maxsum) maxsum = sum;
sum = (a [i] > 0) ? a [i] : 0;
}
else sum += a [i];
}
if (sum > maxsum) maxsum = sum ;
printf ("%dn", maxsum);
}
What is the value printed out when this program is executed?

Q3. [CO2] What does following program?


#include<stdio.h>
void rArray(int arr[], int start, int end)
{
int temp;
while (start < end)
{
temp = arr[start]; 
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;

}  
void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);

printf("\n");

int main() 
{
int arr[] = {1, 2, 3, 4, 5, 6};
int n = sizeof(arr) / sizeof(arr[0]); 
printArray(arr, n);
rArray(arr, 0, n-1);
printf("R array is \n");
printArray(arr, n); 
return 0;
}

Q4. [CO2] Write a program to enter the name as string and convert it into given format.
Eg : SUBHASH  KUMAR  CHAWLA                 S. K. CHAWLA

Q5. [CO2] Write a program, given an array of integers, remove the duplicate elements from the
array.

Q6. [CO2] Write a program in C to remove all occurrences of a character in a string.


String :  hello

Let Character that you want to Remove : l  


 The Final String after Removing all occurrences of 'l' = heo

You might also like