0% found this document useful (0 votes)
4 views4 pages

Model Test Question Paper 2

This document is a model question paper for the Fundamentals of Programming using C course at RV College of Engineering. It includes two parts: Part-A consists of short answer questions, while Part-B contains longer questions requiring detailed answers and programming tasks. The exam duration is 3 hours, and the maximum marks are 100.

Uploaded by

Aarsh Bajaj
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)
4 views4 pages

Model Test Question Paper 2

This document is a model question paper for the Fundamentals of Programming using C course at RV College of Engineering. It includes two parts: Part-A consists of short answer questions, while Part-B contains longer questions requiring detailed answers and programming tasks. The exam duration is 3 hours, and the maximum marks are 100.

Uploaded by

Aarsh Bajaj
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

RV College of Engineering, Bengaluru-560059

( Autonomous Institution affiliated to VTU, Belagavi )


Department of Computer Science and Engineering
Model Question Paper
​ ​ ​ First Semester Autonomous Examinations
22ES14A
Fundamentals of Programming using C
Duration: 3 Hours​ ​ ​ ​ ​ ​ ​ ​ ​ ​ Max marks: 100​
Note: Answer all the questions from Part-A
Answer any 5 full questions from Part-B choosing one from each choice.(Question number 2 is
compulsory)

PART-A
Sl No Marks CO BT PO PI
L CODE
1.1 1 1 1 1 1.6.1
_______ Phase is also called construction or code generation
phase.
1.2 1 1 1 1 1.6.1
C programs are converted into machine language with the help of
_________.
1.3 1 1 1 1 1.6.1
The size of integer variable in C is _____________.
1.4 1 1 1 1 1.6.1
Identify the program that combines object modules to form an
executable program.
1.5 What is the output of the following code? 2 2 2 2 2.5.2
#include<stdio.h>
int main()
{
int a=1, b=2, c=3, d=4, e=5, res;
res = a + b / c – d * e;
printf(“\n Result = %d”, res);
res = (a + b) / c – d * e;
printf(“\n Result = %d”, res);
res = a + (b / (c-d)) * e;
printf(“\n Result = %d”, res);
return 0;
}

1.6 What is the output of the following code? 2 2 2 2 2.5.2

#include<stdio.h>
int main()
{
int x=10, y=20, res;
res = y++ + x++;
res += ++y + ++x;
printf(“\n x = %d y = %d RESULT = %d”, x,y, res);
return 0;
}

1.7 If an array is declared as arr[] = {1,3,5,7,9}; then what is the value 1 2 2 2 2.5.2
of sizeof(arr[3])?
1.8 Differentiate loop regulating statement break from continue. 2 1 1 1 1.6.1
1.9 The memory address of the first element of an array is called 1 1 1 1 1.6.1
__________.

1.10 Name the function which returns the int type value of a string 1 1 1 1 1.6.1
passed to it.
1.11 What is the return value when the instruction 1 2 3 2 2.5.2
y=strcmp(“ABC”,”abc”); is executed?
1.12 The parameters passed to function are called _____________ 1 1 1 1 1.6.1
parameters.
1.13 The life of _____________ variable declared in a function ends 1 2 1 1 1.6.1
when the function is exited.
1.14 What is the use of structure? 1 2 3 2 2.5.2
1.15 What is the purpose of specifying data type for a pointer variable? 1 2 3 1 1.6.1
1.16 What is the output of the following code? 2 1 3 2 2.5.2
int main()
{
struct tree
{
int h;
int b;
}
struct tree tree1;
tree1.h=10;
printf("Height=%d, Width=%d\n",tree1.h,tree1.b);
return 0;
}

PART-B
2 a. What is the use of writing an algorithm? Explain the control 8 1 1 1 4.1.1
structures which can be employed by algorithms with example for
each.
b. With a neat diagram explain the working of a Processor in a 8 1 1 1 1.7.1
computer system.

3a. Give the structure of a C program with an example. 6 1 1 1 1.7.1


b. Give the operator precedence chart? What is associativity and 6 2 1 1 1.7.1
precedence
c. Write a program to find the largest of three numbers using ternary 4 2 3 2 2.5.2
operator.
OR
What do you understand by identifiers and keywords and explain its 6 1 1 2 2.6.3
4 a.
rules
b. Write a program to convert degrees Fahrenheit into degree Celsius. 4 2 2 2 2.5.2
c. Write a program to check given number is palindrome 6 3 3 2 2.5.2
5 a. Write a C program to print the following output and add a note on the 6 3 3 3 3.6.2
logic of the program.

******
*RVCE*
******
b. Write a program to count the total number of nonzero elements in a 6 3 3 3 3.7.1
two-dimensional array and add a brief note on logic.
c. Identify errors, correct them in the following program, rewrite and 4 2 4 2 2.8.2
mention the output of the corrected program.
#include<stdio>
int main([])
{
int i,c, n=4;
char vowels[5]={'a','e','i','o','u'}
for(i=n;i>=0:i- - )) {
c=(int) vowels[i]-32
printf(‘ "\t%c",c);
}
return 0;
}
}
OR
6 a. Write a program to compute and print the electricity bill as per the 6 3 3 4 4.5.1
rates given in the following table according to the units consumed.
Units Rate(Rs)

00 and above 5.50/unit +


20

200-500 3.50/unit +
30

100-200 2.50/unit +
40

Less than 1.50/unit +


100 50

b. Write a program that reads an array of 100 integers. Then display all 6 2 3 3 3.6.2
the pairs of elements in the array whose sum is 50.
c. Compare the following code snippets and mention both are finite 4 2 4 2 2.7.1
loops or infinite loops or both are different loops and add a note on
the logic of any one code snippet.

#include<stdio.h> #include<stdio.h>
int main(){ int main(){
int i,j; int i=0,j=5;
sectionA: for (;;)
for ​ {
(i=0,j=5;i<5,j>=0;i++,j--) ​ printf("d
​ { %d",j,i);
​ printf("%d %d",j,i); ​ i++;
​ goto sectionA; ​ j--;
​ } ​ }
} }

7 a. Illustrate any 4 standard string handling functions with examples. 8 1 2 1 1.6.1


​ ​
b. Write a C program to accept 30 names and initialize the student array. 8 3 3 2 2.5.2
OR
8 a. Write functions to convert feet to inches, convert inches to 10 2 3 1 1.6.1
centimeters, and convert centimeters to meters. Write a program that
prompts a user for a measurement in feet and converts and outputs
this value in meters.
Facts to use: 1ft=12 inches, 1 inch=2.54 cm, 100cm= 1 meter.

b. Using functions, write a program to generate prime numbers between 6 2 3 1 1.6.1


given numbers.

9a. Write a C program to add two complex numbers using structures. 8 2 3 1 1.6.1
Explain the concept of structures within structures with the help of an 8 4 2 2 2.5.2
b.
example.
OR
10 With the help of pointers, write a C program to add two numbers. 6 2 3 2 2.5.3
a.
Explain the concept of pass by value and pass by reference with 10 1 2 1 2.5.2
b. example.
​ ​ ​ ​ ​ ​ ​

You might also like