0% found this document useful (0 votes)
101 views

Cse 1111

The document contains instructions for an online assignment for a CSE 101 course. It provides guidelines that each question should be on a separate page with the student's name, ID, etc. and submitted as a single PDF. It then lists 5 questions: 1) Differentiate between break/continue and arrays/pointers, and find errors in code snippets. 2) Write a function to count vowels in a string. 3) Find safe indices to place a pawn on a 4x4 chessboard. 4) Write a function to print all substrings of lengths 1, 2, and 3 of a given string. 5) Write a function to remove vowels from two input strings and concatenate them.

Uploaded by

Prudhvi Adapa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views

Cse 1111

The document contains instructions for an online assignment for a CSE 101 course. It provides guidelines that each question should be on a separate page with the student's name, ID, etc. and submitted as a single PDF. It then lists 5 questions: 1) Differentiate between break/continue and arrays/pointers, and find errors in code snippets. 2) Write a function to count vowels in a string. 3) Find safe indices to place a pawn on a 4x4 chessboard. 4) Write a function to print all substrings of lengths 1, 2, and 3 of a given string. 5) Write a function to remove vowels from two input strings and concatenate them.

Uploaded by

Prudhvi Adapa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CA: Online Assignment

Course Code: CSE 101


Allocation Date: 29/06/2022
Submission Date: 06/07/2022

IMPORTANT GUIDELINES:

1. The assignment will be a handwritten assignment and it should be submitted as a single


word/pdf document containing pictures of the attempted questions.

2. The student will attempt one question on each page which will contain his/her name,
registration number, roll number, section and signature.[Every page should have these
parameters(Handwritten)]

3. Copy cases will be marked zero.

Section: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Student Name: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Registration Number: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Roll Number: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Signature: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Q1. i) Differentiate between the following : [5]


a) break and continue
b) Array and pointer

ii) Point out the error in the following code if any:


#include <stdio.h>
int main(void)
{
int a = 4 % 5;
printf("\n%d, a);
return 0;
}

iii) Have a look at the following piece of code and state the output.
#include <stdio.h>
int main(void)
{
int i = 10;
if(i > i)
printf("\nHi");
else
printf(“\nBye");
return 0;
}

iv) Point out the error in the following code if any:


#include <stdio.h>
int main(void)
{
int num = 10;
ans = num > 10;
printf("\n%d", ans);
return 0;
}

v) Have a look at the following piece of code and state the output.
#include <stdio.h>
int main(void)
{
for(;;);
printf("\nHi");
return 0;
}

Q2. Write a program which has a function to which a string is passed and the program should be
capable of counting the vowels in the string. [5]

Input:
“hello”
Output:
2

Q3. Given a 4 x 4 matrix representing a chessboard where ‘X’ indicates the presence of a pawn
which can move one step in the direction [up, down, left, right] print out the indices where it is
safe to place your pawn so that it is not in the range of the other pawns. [10]

Sample Run:

Input:
...X
X..X
.XXX
....

Output:
Safe indices are:
0,1
3,0

Q4. Andrew likes the topic of strings a lot and tries to solve as many problems as he can on this
topic. He came across a problem in which he was given a string and he was asked to print all
substrings of length 1, 2 and 3 from it. Please use a function which receives the string passed as a
parameter and print the substrings. [5]

Sample Run:

Input:
abcd

Output:
All substrings of length 1:
abcd
All substrings of length 2:
ab bc cd
All substrings of length 3:
abc bcd

Q5. Write a program which has a function to which we pass two strings represented as pointers.
The function should be able to remove all the vowels from both the strings and concatenate them
together. [5]

Sample Input :
First String : “abdef”
Second String : “ghijk”

Sample Output :
“bdfghjk”
Note : The second string should be concatenated at the end of the first string.

You might also like