0% found this document useful (0 votes)
107 views

C Mid Test PDF

This document contains a sample midterm test for a programming with C language course. The test contains 20 multiple choice and fill-in-the-blank questions testing knowledge of C programming concepts like data types, standard library functions, control structures, functions, variables, arrays, loops, and conditional statements. It also includes 20 code snippets with questions about the output of each snippet.

Uploaded by

Dinesh Lasantha
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)
107 views

C Mid Test PDF

This document contains a sample midterm test for a programming with C language course. The test contains 20 multiple choice and fill-in-the-blank questions testing knowledge of C programming concepts like data types, standard library functions, control structures, functions, variables, arrays, loops, and conditional statements. It also includes 20 code snippets with questions about the output of each snippet.

Uploaded by

Dinesh Lasantha
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/ 2

NATIONAL SCHOOL OF BUSINESS MANAGEMENT

Common First Year -1st Semester – All the Computing related Degree Programs
Sample Paper - Mid Test
Module Name: Programming with C Language

Answer All Questions (20 marks) Time: 1 hour

Questions 1) to 10) : Fill in the blanks in each of the following.

1. To store numbers with fractions we can use float and _______________ data types.

2. The _______________ standard library function displays information on the screen.

3. All programs can be written in terms of three types of control statements: sequence , selection and
_________________.

4. The _____________ repetition statement specifies that a statement or group of statements is to be


executed repeatedly while some condition remains true.

5. The && , || and ! are called as __________________ operators.

6. The _______________ statement, when executed in a repetition statement or a switch, causes


immediate exit from the statement.

7. A function called by itself is called as _________________ function.

8. A variable defined outside any block or function is a (n) _______________ variable.

9. In an array index begins with _________.

10. We can declare an array named arr with 3 rows and 4 columns as ___________.

Write the outputs (In front of the question) of each of the following program segment. All the
code is written inside the main function with the header files

11. int x=10;


printf("%d",x++);
printf("%d",++x);

12. int x=10,y=20;


if(x>=5 && y>=5)
printf(" Y \n");
else
printf(" N \n");

13. int a=5;


if(a>5)
printf(" A \n");
else if(a==5)
printf(" B \n");
else
printf(" C \n");

Page 1 of 2
14. int p=1;
switch(p)
{
case 0:printf("P ");
case 1:printf("Q ");
case 2:printf("R ");break;
default:printf("S ");
}

15. int x=10;


while(x<=100)
{
printf("%d ",x);
x+=10;
}

16. int p;
for(p=50;p>=10;p=p-10)
printf("%d ",p);

17. int a=1;


do
{
printf("%d ",a);
a=a+1;
}while(a<=5);

18. int a=1;


while(a<=5)
{
if(a%2==0)
printf("%d ",a);
a++;
}

19. int x,y;


for(x=1;x<=5;x++)
{
for(y=1;y<=5;y++)
{
printf("* ");
}
printf("\n");
}

20. int sum=0,x=1;


while(x<=5)
{
sum=sum+x;
x++;
}
printf("%d",sum);

Page 2 of 2

You might also like