Cie 1 Icp Modified2

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

CIE-II

Class: FY BTech Course: Computer Engineering


Subject: ICP Max. Marks: 30
Date: 12th October 2018 Duration: 1 hour
1. Attempt all questions
2. Figures to the right indicate full marks.
3. Steps of hand running of the program must be shown wherever output of the program is asked.

Q. 1 Choose appropriate option from the following 1x5


A Maximum number of elements in the array declaration int a[5][8] is ----
A] 28 B] 32 C] 35 D] 40
B Array subscripts in C always start at
A ] -1 B] 1 C] 0 D] Value provided by user
C Array elements are always stored in -------- memory locations
A. Sequential B. Random C. Random and Sequential D. None of the above
D What is the built-in library function for comparing the two strings?
a. strcmp() b. equals() c. str_compare() d. string_cmp()

E Which keyword is used to transfer control from a function back to the calling function?
a. return b. goback c. goto d. switch

Q. 2 Write a C program to reverse the element of an integer 1-D array using function. 8
Q. 3 Given two arrays of integers A and B of sizes M and N respectively. Write a function 8
named MIX () with two arguments, which will produce a third array named C. such that
the following sequence is followed.
All even numbers of A from left to right are copied into C from left to right.
All odd numbers of A from left to right are copied into C from right to left.
All even numbers of B from left to right are copied into C from left to right.
All old numbers of B from left to right are copied into C from right to left.
A, B and C are passed as arguments to MIX (). e.g., A is {3, 2, 1, 7, 6, 3} and B is {9, 3, 5, 6,
2, 8, 10} the resultant array C is {2, 6, 6, 2, 8, 10, 5, 3, 9, 3, 7, 1, 3}
Q. 4 What is the purpose of the following program. Find the output of the 5
program if the input sentence is “Vishwakarma University”

#include <stdio.h>
#include <conio.h>
int main()
{
char str[1000];
int i=0, count=1;
clrscr();
printf("\n Enter the sentence: ");
gets(str);
while(str[i] != '\0')
{
if(str[i] == ' ' && str[i+1] != ' ')
count++;
i++;
}
printf("\n The total count of words is: %d", count);
return(0);
}
Q. 5 5

Q. 6 Write a program in C to check whether a given string is a palindrome 5


or not?

You might also like