0% found this document useful (0 votes)
13 views2 pages

Cie 3 Icp

This document contains a test for a computer engineering class. It has 6 multiple choice and short answer questions about C programming concepts like pointers, structures, recursion, and functions. Students are asked to write code to solve problems related to these topics and predict output.
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)
13 views2 pages

Cie 3 Icp

This document contains a test for a computer engineering class. It has 6 multiple choice and short answer questions about C programming concepts like pointers, structures, recursion, and functions. Students are asked to write code to solve problems related to these topics and predict output.
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/ 2

Vishwakarma University

Science and Technology


CIE-III
Class: FY BTech Course: Computer Engineering
Subject: ICP Max. Marks: 30
Date: 13thNovember 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 void fun(int *ptr) int main()
{ {
*ptr = 30; int y = 20;
} fun(&y);
printf("%d", y);
return(0); }

A. 20 B. 30 C. Compiler Error D. Run time Error

B int main()
{
float arr[5] = {12.5, 10.0, 13.5, 90.5, 0.5};
float *ptr1 = &arr[0];
float *ptr2 = ptr1 + 3;

printf("%f ", *ptr2);


printf("%d", ptr2 - ptr1);
return 0;
}
A. 90.500000 3 B. 90.500000 12 C. 10.000000 12 D. 0.500000 3

C void f(int *p, int *q) int i = 0, j = 1;


{ int main()
p = q; {
*p = 2; f(&i, &j);
} printf("%d %d n", i, j);
getchar();
return 0;
}

A 2 2 B 2 1 C. 0 1 D. 0 2

D #include<stdio.h> int main()


struct st { struct st temp;
{ temp.x = 10;
int x; temp.next = temp;
struct st next; printf("%d", temp.next.x);
}; return 0;
}
A. Compiler Error B. 10 C. Runtime Error D. Garbage Value

E include <stdio.h> main()


struct temp {
{ func(s);
int a; printf("%d\t", s.a);
} s; }
void func(struct temp s)
{
s.a = 10;
printf("%d\t", s.a);
}
a)10 (Garbage Value) b) 0 10 c) 10 0 d) (Garbage Value) 10

Q. 2 Write a program in C to find the first capital letter in a string using recursion. 8

Q. 3 Write a program to add two distances in inch-feet using structure. The values of the distances are to 8
be taken from the user.

Q. 4 What is the output of the following program t = fun ( n-1, fp ); 5


int fun ( int n, int *fp ) f = t + *fp;
{ *fp = t; return(f);
int t, f; }
if ( n <= 1 ) int main()
{ {
*fp = 1; int x = 15;
return 1; printf("%d\n",fun(5, &x));
} return(0); }

Q. 5 What is the output of the following program fun(n-1); 4


#include <stdio.h> }
void fun(int n) }
{ int main()
if(n > 0) {
{ fun(4);
fun(n-1); return(0);
printf("%d ", n); }
OR
Q. 6 Write a program in C to reverse a string using recursion 4

You might also like