[go: up one dir, main page]

0% found this document useful (0 votes)
51 views3 pages

CIE 2 ICP Set1

This document contains instructions for a computer engineering exam. It includes 6 questions - multiple choice and short programs. The questions test concepts like arrays, functions, string handling, sorting and removing duplicates in C programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views3 pages

CIE 2 ICP Set1

This document contains instructions for a computer engineering exam. It includes 6 questions - multiple choice and short programs. The questions test concepts like arrays, functions, string handling, sorting and removing duplicates in C programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Vishwakarma University

Science and Technology


CIE-II
SET-I
Class: FY BTech Course: Computer Engineering
Subject: ICP(BTECHCS18106) Max. Marks: 30
Date: 12thOctober 2018 Duration: 1 hour
1. Attempt all questions
2. 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 Which of the following statements are correct about array in C?
1. The expression num[2] represents the very second element in the array
2. The declaration of num[SIZE] is allowed if SIZE is declared as a global
variable.
3. The array of intnum[20]; can store 20 elements
4. It is necessary to initialize array at the time of declaration
a. 1, 2 b. 2,4 c. 3 d. none of the these
B Array subscripts in C always start at
A ] -1 B] 1 C] 0 D] Value provided by user
C If S is an array of 80 characters, then the value assigned to S through the statement
scanf("%s",S) with input 12345 would be
A. “12345” B. Nothing, Since 12345 is an integer C. S is an illegal name for string
D. %s cannot be used in string input
D What is the output of the following program
int main()
{ int arr[5], i=-1,z;
While(i<5)
arr[i]=++i;
for (i=0;i<5;i++)
printf(“%d”,arr[i]);
return(0);
}
a. 1 2 3 4 5 b. -1 0 1 2 3 4 c. 0 1 2 3 4 d. 0 -1 -2 -3 -4
E What is the output of the following program
#include <stdio.h>
void foo()
{
return(1);
}
void main()
{
int x = 0;
x = foo();
printf("%d", x);
}
a) 1 b) 0 c) Runtime error d) Compile time error
Q. 2 Write a C program using function to perform computation of sin (x) as given below : 8
Q. 3 Write a program to arrange numbers in ascending order in an array 8
using bubble sort.
Q. 4 Find the output of the following program 5
#include<stdio.h>
int find_abc(int, int);
int main()
{
int a, b, lcm;
printf("\n\nEnter 2 integers :\n");
scanf("%d%d", &a, &b);
lcm = find_abc(a,b);
printf("\n\n LCM of %d and %d is: %d\n\n", a, b, lcm);
printf("\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}
int find_abc(int a, int b)
{
int temp = 1;
if(temp%a == 0 && temp%b == 0)
{
return temp;
}
else
{
temp++;
find_lcm(a,b);
return temp;
}
}
Q. 5 #include<stdio.h> 4
#include<string.h>
int main()
{
char aj[1000], mj[1000];
int i = 0, j = 0, len;

printf("\n\nEnter the string: ");


gets(aj);

len = strlen(aj);
while(aj[i] != '\0') {
if(aj[i] != ' ') / {
mj[j++] = aj[i];
}
i++;
}
mj[j] = '\0';
printf("\n\n%s", mj);
return(0); }
OR
Q. 6 Write a program in C to remove duplicate elements from the given 4
array.

You might also like