|Department||B.E Computer Science|
|Subject & Subject Code||CS 6101 Programming with C|
Anna University Question Bank
Anna University B.E Computer Science CS 6101 Programming with C Question Bank
Download Anna University Programming with C Question Bank
|CS 6101 Programming with C Regulation 2018||Download Question Bank Here|
Anna University Programming with C Question Bank
Part-A (10 x 2 = 20 Marks)
1. What is the exact command you need to type to copy a file A to a fi – the exact stepsyou need to take, if a mouse is used.
2. Give examples to show the difference between “<” and “<=” operators.
3. What does the following print:int i=5;if (i>3)printf(“i > 3\n”);else;printf(“i <= 3\n);
4. Write the while loop which will count the number of occurrences of a given integer “m” in aninteger array which has “n” integers. (All the other statements needed for a complete programcan be assumed to be there.)
5. What is the value in variable n after the following: #define SIZE 5 int n = SIZE;
6. Consider the following program segment. What will be the value of k.int a ;int k, *p;a=1;a=2;a=3;p=a;k = *(p+1);
7. Declare a structure to store student roll number, age, mark in mathematics, physics andchemistry.
8. What is the function which has to be used before you use the function fread to read from afile.
9. Give examples of postfix and prefix operators.10. Give an example of using #include,
Part – B ( 8 x 8 = 64 marks) (Answer any 8 questions)
11. (i) What are the different keys which are used while editing a C program and what doeseach one do? (4 marks)
(ii) Describe the connection between a variable and a memory address. (4 marks)
12. (i) Write a complete C program which accepts an integer from the user, adds 2 to it, anddisplays both the values. Use appropriate messages. (4 marks)
(ii) Explain what the operators / and % do on integers. Show what happens for specificexamples of two integer variables i and j in the following statements given below. What is theexpression you will use to get back the value of i, given mr and j.int inj.m,rm=i/j;r=i%j;
13. (i) What is the difference between while and do-while? Give an example and explain thedifference. (4 marks)
(ii) Show, using an example, how an enum can be used instead of a #define. (4 marks)
14. (i) Write the program statements to do the following: Declare an array of 3 integers. Put avalue into each integer element of the array. Display the 3 elements using a single printi.
(ii) Write the program statements to do the following: Declare a char array, put some examplecharacters ‘a’, ‘b’, ‘c’, and then the null character (‘\0’). What will happen when you useprintf(“s”);
15. ((i)) What values are printed in the following program segment:void mainint i, j;i = 5;j = 6;k = add(i, j);printf(“%d, %d%d\n”,i,j,k);95add(i, j)int i;int j;i=i+j;j=i-j;return (i+j);What happens in the following program segment:void mainint i, j;i = 5;j = 6;mul(i, j, k);printf(“%d, %d, %d\n”,i,j,k);mul(i,j)int i, j,k;k=i*j;return(i+j);
16. (i) Declare small arrays of int, and char. Declare pointers int * p, char *q. Fill the arrays withappropriate example values. Initialise p and q to the arrays. What will be the iype of valuedisplayed by *p and *q. What will be displayed for *(p+1) and *(+1).
(ii) Find the length of a given string. Use malloc to allocate space. Copy the characters of anexisting string to this allocated space and print both strings. What should be the size requestedto malloc?
17. (i) Declare an array of structures, where each structure has student registration number,day, month and year of birth. Get input from the user and fill the array. Find the number ofstudents who were born in a given year.
(ii) Give examples of union and structure and show the difference in their usage.
anna university question bank, anna university question bank regulation 2017, anna university question bank regulation 2013, anna university question bank mechanical engineering, anna university mba question bank, anna university dbms question bank, mba anna university question bank, anna university 1st semester question bank , discrete mathematics anna university question bank , anna university mba mcq question bank , anna university 2nd semester question bank, anna university question bank book, business research methods anna university question bank, biochemistry question bank anna university, anna university question bank for me cse regulation 2017
Have a question? Please feel free to reach out by leaving a comment below