End Online
End Online
int main()
{
int a[] = { 12, 7, 13, 4, 11, 6 };
printf("%d", f(a, 6));
return 0;
}
b) You are supposed to enter the inputs as “your first name” and “your last name”. Now after receiving the
inputs, transform your entered first name and your entered last name into the binary strings, in such a way
Page 1 of 3
that the vowels are represented with 1’s and consonants are represented with 0’s. Example: User entered
first name: “abc”, last name: “mno” -write “100”, “001” respectively. Write a program to perform bitwise
AND, OR and XOR on these two binaries.
NOTE: Represent binary strings in 16 bits. You may prefix the strings with 0’s to make your operations
compatible.
Q3 a) Write a C program to enter your Scholar No. in an array starting from 0th index. Firstly, separate
the numbers in even and odd indices. Then, add the digits in these indices. Lastly, multiply the 6+4
separate sum computed. For example, if your scholar no. is S[i]: =10
2 0 3 1 1 2 5 0 1
Find out the elements for even and odd indices say E[i] and O[i]. Calculate the summation of all the
elements in E[i] and O[i] separately. Then, find the product of these two summations.
b) Write the if-else-if equivalent code for the following code snippet. Also show output of your program by
taking input as (last_3digit_roll_no %10).
Q4 a) Write a C program for the square matrix pattern, where each Nth row contains the same N value. 5+5
Add corner elements and check whether the sum is equal to 10 or not. =10
b) Write a program to find the frequency of characters in a string without using
== operator.
Sample output: Enter a string - awesome
Enter a character to find its frequency - e
Frequency of e - 2
Q5 a) Consider the below snippet of code. Enter your FirstNameXLastNameX as input to the program character
by character in sequence. For example, if your name is AMIT ROY then enter as below
A 6+4
M =10
I
T
X
R
O
Y
X
Answer the following with respect to your own first and last name (ignore middle name if any).
(i) How many times is the function myFunc1() called before termination of the program?
(ii) What is your final output?
Zero (0) marks will be awarded in case you enter someone else’s firstname and lastname as input and show
final output.
Page 2 of 3
b) Write a program to replace all EVEN elements by 0 and Odd by 1 in One Dimensional Array without using
% and == operators. You can use any other operators. You can assume an initialised array of size 10.
-----------------------------------------------------------End---------------------------------------------------------------
Page 3 of 3