Summer Test
-
Upload
sanjeev-singh -
Category
Documents
-
view
214 -
download
0
description
Transcript of Summer Test
-
Birla Institute of Technology and Science Pilani, Hyderabad Campus
Summer Term 2015 Computer Programming CS F111 Test 1 Exam
Date: 09.06.2015 Duration: 60 minutes Type: Closed Book Max Marks:20
-------------------------------------------------------------------------------------------------------------------------------
Instructions :
1. Attempt all questions.
2. Assume that #include is there in all the code segments given in the
questions.
-------------------------------------------------------------------------------------------------------------------------------
1. Answer the following question using TRUE (T), FALSE(F) [5 Marks]
a. while (i =< 10) statement in C code is correct.
b. The word main is a reserved word in C language.
c. while loop body , executes atleast one time irrespective of condition is either true or
false
d. In stages of compilation, during linking stage the following statement
#include gets replaced by the contents of the file stdio.h
e. For the following statement
a=0;
a= (a=0)? 2:3;
printf(%d,a);
Output is 2
2. Give output for the following problem [1 marks * 5 = 5 marks]
a.) int main() { int a = 10, b = 11, c = 15; if(c
-
e.) int main() { int x = 4, y = 0, z; while(x >= 0) { x--; y++; if(x == y) continue; else printf("%d %d\n", x , y); } return 0; }
3. Draw a flowchart for the following problem [5 marks]
Problem is to read N and generate the following pattern for N lines
for N = 4
1 23 456 78910
4. Write a C Program to input a positive integer number (having more than 1 digit) and find the
sum of first digit and last digit. [5 marks]
for example if input: 12345 then output: 6 ( reason 1 + 5 = 6 )