C Programming-Question Bank
C Programming-Question Bank
QUESTION BANK
Subject/ Subject Code: Programming in ‘C’ and Data Structure (15PCD14)
Academic Year / Semester: 2016-17, 1st Semester
PART-A
1.
a. What is pseudo-code? Compare it with an algorithm. (05 Marks)
b. Convert the following into ‘C’ expression:
𝑍
i) 𝑋𝑌 ii) 𝑒√𝑋 iii) 𝑎. 𝑏
√𝑐. 𝑑
iv) √𝑠(𝑠 − 𝑎)(𝑠 − 𝑏)(𝑠 − 𝑐) (04 Marks)
c. Write a C program to find largest among three integer using ternary
operators. (06 Marks)
a. Explain formatted input and output statements with examples.
(05 Marks)
2.
a) Write a structure of C program. List primitive data types with size and
range (10 Marks)
b) Define type casting .explain with an example (04 Marks)
c) Evaluate following (where i=2,j=3,k=4 and a=5):
i) a=i*(j/=k/i) ii)a>>i%j iii)i*a/i%i. (06 Marks)
PART-B
3.
a) Write a C program to grade students result based on following conditions:
i) Marks<35 grade “fail”
ii) 35≥Marks<60 grade “second class”
iii) 60≥Marks<70 grade “first class”
Iv) 70≥Marks≤100 grade “first class with distinction”. (08 Marks)
b) Explain switch statement with an example (07 Marks)
1
Computer Concept and C Programming 2016-17
4.
a) Explain cascade if-else and nested if-else statements. (06 Marks)
b) Write a C program to implement simple calculator using
operators +,-,*and /.also handle divide by zero error. Use switch statement.
(10 Marks)
c) What is dangling else problem? Explain how to handle this in C
programming (04 Marks)
PART-C
5.
a) Define array? How two dimension arrays are declared and initialized?
(06 Marks)
b) Write a C program to generate Fibonacci numbers using arrays (06 Marks)
c) Explain following string functions: i)strlen ii)strcpy iii)strcmp iv)strcat
(08 Marks)
6.
a) Explain various ways of passing parameters to the functions (06 Marks)
b) Write a C program to find factorial of an integer using recursive function
(08 Marks)
c) Write a C program to find length of a string without using strlcn() function
(06 Marks)
PART-D
7.
a) Compare array with structures (06 Marks)
b) Define structur.Explain it with an example (05 marks)
c) Explain the following:
I. Typedef to define structure
II. Accessing structure members
III. Initialization of a structure (09 Marks)
8.
a) Explain the following file handling functions:
i) Fopen() ii) fclose() iii) fscanf() iv) fprintf() v) fseek()
(10 marks)
b) Write a C program to create a integer data file and then segregate odd and
even integers into two different files .
(10 marks)
PART-E
2
Computer Concept and C Programming 2016-17
9.
c) What is pointer? explain with program (06 Marks)
d) Explain the following:
i) #define ii) #include iii) nesting of macro iv) argumented
macro
(10 Marks)
d) Explain malloc and calloc functions
(04 Marks)
Dec.2015 – Jan.2016
Module -1
1.
a. What is variable? Explain the rules for constructing variables in C language?
Give examples for valid and invalid variables. (6 marks)
OR
2.
a. Write a C program which takes as input p, t, r. Compute the simple interest
and display the result. (6 marks)
Module -2
3.
3
Computer Concept and C Programming 2016-17
OR
4.
a. Write a C program that takes from user an arithmetic operator(‘+’, ‘-‘ , ’ * ’ or
‘/ ’ ) and two operands . Perform the corresponding arithmetic operation on
the operands using switch statement. (8 marks)
b. What is an array? How to declare and initialize the two dimensional array?
(8 marks)
Module -3
5.
a. What is a function? Write a C program to find the cube of a number using
function. (5 marks)
6.
a. Write a C program to sort the elements by passing array as function argument.
(8 marks)
Module -4
7.
a. What is structure? Explain the C syntax of structure declaration with example.
(5 marks)
4
Computer Concept and C Programming 2016-17
OR
8.
a. Write a C program to store and print name, USN, subject and IA marks of
students using structure. (8 marks)
Module -5
9.
a. What is a pointer? Write a C program to find the sum and mean of all elements
in an array using pointer. (8 marks)
OR
10.
a. Write a C program to swap two numbers using call by address. (6 marks)
c. What are primitive and non-primitive data types? Explain with examples.
(5 marks)
1.
5
Computer Concept and C Programming 2016-17
a. What is two way selection statement? Explain if, if-else, nested if-else and
cascaded if-else with examples and syntax.
(10 marks)
b. Write a program that takes three coefficiants (a, b, and c) of quadratic
equation: (ax2+bx+c) as input and compute all ossible roots and print them
with appropriate message.
(10 marks)
4.
a. Explain switch statement with an example.
(6 marks)
b. What is loop? Explain the different loops in C language.
(10 marks)
c. Show how break and continue statement are used in a C program, with
example.
(4 marks)
5.
a. What is an array? How single dimensional array is is declared and initialized?
(6 marks)
b. Write a C program to evaluate the polynomial f(x) =a4x2+a3x3+a2x2+a1x+a0, for
a given value of x and its coefficients using Horner’s method.
(6 marks)
c. Explain string manipulation functions, with examples.
(8 marks)
6.
6
Computer Concept and C Programming 2016-17
(10 marks)
9.
a. What is pointer? Write a program in C to find the sum and mean of all elements
in an array. Use pointer technology.
(8 marks)
b. What is preprocessor directive? Explain #define and #include preprocessor
directives.
(8 marks)
c. Explain:
i) Dynamic memory allocation.
ii) Malloc function.
(4 marks)
10.
a. What is a primitive and non primitive data type? Explain.
(6 marks)
b. Define queue. Explain it along with its application.
(8 marks)
c. Explain.
i) Abstract data-type.
ii) Stack
7
Computer Concept and C Programming 2016-17
Note: Answer any FIVE full questions, choosing one full question from each
module.
MODULE 1
b. What is an operator? Explain the arithmetic, relational, logical, and (10 Marks)
assignment operators in C language.
MODULE 2
3) a. Explain the two way selection (if, if-else, nested if-else, cascaded if- (8 Marks)
else) in C language with syntax .
b. Explain the switch statement with syntax and example. (8 Marks)
c. Design and develop a C program to read a year as an input and find (4 Marks)
whether it is leap year or not. Also consider end of the centuries.
OR
4) a. Explain the different types of loops in C with syntax and example. (8 Marks)
8
Computer Concept and C Programming 2016-17
b. Explain the use of break and continue statement in loops with example. (6 Marks)
MODULE 3
OR
6) a. Explain any five string manipulation library functions with examples. (10 Marks)
MODULE 4
b. What is a file? Explain how the file open and file close functions (6 Marks)
handled in C.
9
Computer Concept and C Programming 2016-17
c. Write a C program to maintain a record of “n” student details usingan (10 Marks)
array of structures with four fields (Roll number, Name, Marks, and
Grade). Each field is of an appropriate data type. Print the marks of the
student given student name as input.
OR
c. Write a C program to read and display a text from the file. (6 Marks)
MODULE 5
9) a. What is a pointer? Explain how the pointer variable declared and (4 Marks)
initialized.
b. What is dynamic memory allocation? Write and explain the different (6 Marks)
dynamic memory allocation functions in C.
c. What are primitive and non-primitive data types? (4 Marks)
d. Write a C program to swap two numbers using call by pointers method. (6 Marks)
OR
10
Computer Concepts and C Programming 2016-17
11
Computer Concepts and C Programming 2016-17
b. Mention the various functions of an operating system. Explain any two of them.
(08 Marks)
c. List and explain the basic components of a computer network.
(04 Marks)
d. Mention the different storage devices and explain one of them.
(04 Marks)
12
Computer Concepts and C Programming 2016-17
c. Write a program to find the area of a triangle given the three sides.
(06 Marks)
d. With examples, illustrate any four common programming errors.
(04 Marks)
iv) The least number of times the do-while loop will be executed is _
A) 0 B) 1 C) 2 D) Both A & B
A) 3 B) 6 C) 52 D) 4
iv) A function that is used to join two strings is
A) Strepy B) Strlen C) Streat D) Stremp
c. What are threads? Give the advantages and disadvantages of multiple threads.
(06 Marks)
*******
14
Computer Concepts and C Programming 2016-17
15
Computer Concepts and C Programming 2016-17
16
Computer Concepts and C Programming 2016-17
PART-B
17
Computer Concepts and C Programming 2016-17
b. List the different decision making statements. Explain any two with their syntax
and example. (07 Marks)
c. Write the C-code to find factorial of a number with all the looping statements.
(06 Marks)
d. Explain the use of break and continue statements. (03 Marks)
A) 1, 5 B) 1, 6 C) 0, 4 D) 0, 5
ii) An array is a group of related data that shares a common
A) name B) index C) values D) all of these
iii) Which of the following statement assigns the value stored in x to the first
element on an array, ary?
A)ary=x[1]; B)ary=x[0]; C)ary[0]=x; D)ary[1]=x;
iv) The de-limiter in a C string is:
A) new line B) a del character C) a null character D) none of these
b. Explain the declaration and initialization of one-dimensional array, with an
example. (06 Marks)
c. Explain the initialization and declaration of C — strings. (04 Marks)
d. Write a C program to read an array of size ‘N’ and print the array elements.
(06 Marks)
8 a. Choose your answers for the following: (04 Marks)
i) Parallel computing is execution of instructions in a computer.
A) simultaneous B) serial C) accurate D) complete
ii) Which of the following is not a synchronization construct?
A) single B) master C) section D) critical
ii) reduces multiple
private copies of variables
belonging to different
threads into a single value.
QUESTION BANK
18
Computer Concepts and C Programming 2016-17
UNIT-I
CHAPTER 1: INTRODUCTION TO COMPUTER SYSTEM, INTERACTING
WITH THE COMPUTER, COMPUTER ORGANIZATION
2. a. Choose the correct answers for the following : (04 )( June/July 2013)
i) The term dots per inch (dpi) refers to printer’s _ .
A) Resolution B) speed c) output D) colours
ii) is used to identify product and provide information such as
price.
a) Price checkb) Barcode reader c)Numeric digit
d) Light sensitive detector
iii) is not a computer language.
a) Assembly language b)High level language.
C) Natural language d) Machine level language
iv) Which operating system first appeared with IBM PC?
4. With a neat figure, explain how instructions are processed by the CPU.
5M( (dec 2013)
5. Describe briefly about the various keys present on a standard keyboard.
5M( (dec 2013)
6. What is information processing cycle? Explain four steps with flow chart.
(04) (June/July 2013)
7. With a neat diagram, explain functions of each units of basic model of computer.
(06) (June/July 2013)
8. Convert the following: (06) (June/July 2013)
i) (10101)2 = ( ? ) 10 = ( ? ) 16 ii) (50) 8 = ( ? ) 10 = ( ? ) 2
19
Computer Concepts and C Programming 2016-17
10. Identify and categorize the basic component of a computer, with a neat diangram.
11. How would you describe basic structures of a computer.
20
Computer Concepts and C Programming 2016-17
21
Computer Concepts and C Programming 2016-17
b. What is information processing cycle? Explain four steps with flow chart.
(04) (June/July 2013)
c. With a neat diagram, explain functions of each units of basic model of
computer. (06) (June/July 2013)
d. Convert the following: (06) (June/July 2013)
i) (10101)2 = ( ? ) 10 = ( ? ) 16 ii) (50) 8 = ( ? ) 10 = ( ? ) 2
UNIT-II
CHAPTER 2: STORAGE DEVICE CONCEPTS, OPERATING SYSTEM,
NETWORKING
1. a. Choose the correct answers for the following :(04 Marks) ( June/July 2013)
i) _ is two or more LAN’s connected together across large
geographical area.
a) GAN b) LAN c) WAN d) MLAN
ii) Temporary storage in main memory is called as .
a) Buffer b) Secondary Memory
1. Explain in detail about the construction and operation of the hard disk drive.
5M( (dec 2013)
22
Computer Concepts and C Programming 2016-17
23
Computer Concepts and C Programming 2016-17
20. What id a floppy disk. What are the various components of a floppy disk?
21. What is a Hard Disk? Give its advantages and disadvantages.
22. What are the differences between Floppy disk and Hard disk?
23. What is Magnetic tape? What are the advantages and disadvantages of magnetic
tape?
24. What are optical storage devices? Explain the different types of optical storage
devices.
25. Explain how the performance of a drive is measured.
26. How to optimize disk performance? Explain. (06) (Dec 08/ Jan 09)
27. Describe with a neat sketch, the features and working of magnetic tape unit .what
are the merits demerits? ( Jan/Feb 2006)
30. Explain the following storage devices with figure
i) Magnetic tape and ii) magnetic disk (Aug/2008)
31. What is an operating system?
32. What are the purposes or primary functions of the operating system?
33. Differentiate between Graphical user interface and Command user interface
(06)(July 2007)
34. List and explain the four major types of operating systems.
(08) (Dec 08/ Jan09)
35. List any five types of operating system? (06)(July 2008)
36. What is preemptive scheduling and non preemptive scheduling?
42. What is a network?
43. What are the various benefits of using a network?
44. What is a LAN? What are the advantages and disadvantages of LAN?
45. What is a WAN? What are the advantages and disadvantages of WAN?
46. Differentiate between LAN and WAN.
47. What is a Topology? Explain different network topologies.
(08) (Dec 08/ Jan 09)
48. Explain the features of various network topologies. (08) (July 2007)
49. Explain the following terms.
24
Computer Concepts and C Programming 2016-17
25
Computer Concepts and C Programming 2016-17
7. What are identifiers? Discuss the rules to be followed while naming identifiers.
Give examples. (06) ( June/July 2013)
8. Explain format specifiers used in scanf( ) function to read int, float , char, double
and longint datatypes . (06) ( June/July 2013)
9. a. Choose the correct answer: (04) (Jan 2013)
ix) ‘C’ is what kind of language?
(A) Machine (B) Procedural (C) Assembly (D) Object
oriented programming
x) The hexadecimal constant is preceded by
(A) OX (B) O (C) HX (D) H
xi) The number 025 is number
(A) Decimal (B) Octal (C) Hexa (D) Binary
xii) The operator % yields
(A) Quotient (B) Percentage (C) Reminder (D) Fractional part
10. b. Briefly explain how to create and run the program. (06) (Jan 2013)
11. c. Explain f-types of data with its range value. (06) (Jan 2013)
12. d. Explain formatted input and output functions. (04) (Jan 2013)
13. Explain in detail the steps involved in Creating and Running of programs.
14. Describe the basic steps in system development life cycle.
15. What is a flowchart?
16. Explain with example an algorithm and flowchart. (06) (Jul / Aug 2004)
17. What is the need for a flowchart? What are the drawbacks of a flowchart?
Compare and contrast algorithms and flowcharts. (10) ( Jan 2007)
18. What is flowchart symbol? What are the symbols used while writing a flowchart?
19. Write an algorithm and flowchart for the following:
a. Area of a triangle
b. Area of a circle
c. Check whether the given number is odd or even.
d. Check whether a number is +ve, -ve or zero.
e. Exchange the contents of two numbers.
f. Largest of two numbers.
g. Largest of three numbers (08) (Jan / Feb 2003)
26
Computer Concepts and C Programming 2016-17
20. Write an algorithm and flowchart to find the roots of a quadratic equation
showing all the possible conditions. (08) (July/ Aug 2003)
21. Write an algorithm and flowchart to find whether a given number is prime or not.
(05) (Dec 08/Jan 09)
22. Write an algorithm and flowchart to find factorial of a given integer.
(06) (Dec 08/ Jan 09)
23. Write an algorithm to find
b) The total number of even integers
c) The total number of odd integers
d) The sum of all even numbers
e) The sum of all odd numbers
from a given set of 100 integers. (10) (Jan / Feb 2004)
24. Explain the structure of a C program with example.
25. What are identifiers? What are the rules to be followed to frame an identifier?
26. What are keywords? What are the various keywords available in C?
27. Define identifiers, constants and keywords. Give the various rules for formulating
identifiers in ‘C’ language. (08) (July 2007)
28. What are the different types of data types available in C language? Explain with
examples.
29. What is a variable? What is the use or significance of a variable? What are the rules
to be followed while writing variable names?
30. List out the five rules to be followed while having a variable. Give one example for
each rule with invalid case. (06) (Jul/ Aug 2005)
or
31. What are the primary or basic data types available in C language? Explain with
examples.
27
Computer Concepts and C Programming 2016-17
34. Pick the incorrect floating point constants and give reasons for the same:
i) 40,945.65 ii) 428.58 iii) 46E2 iv)465. v) 43 (05)(Jan/Feb2004)
35. What are escape sequence characters? Explain with example.
36. What is a string constant? What is the difference between a character .
37. What are Coding constants? Explain the different types of Coding constants.
38. What is a stream? Explain the two forms of streams.
39. What are the various formatted I/O functions in C? Give the syntax of each with
an example.
or
With example, explain scanf() and printf() functions. (06) (Jan/Feb 2003, July
2007)
40. Explain the two levels of program documentation with examples.
41. Explain briefly printf() with format specifiers. (06)(Jul/Aug 2004)
42. Give any three input and three output statements in C, give an example for each.
(12) (Feb/Mar 2005)
40. What if formatted output? Explain output of integer and real numbers, using an
example for each. (08) (May/June 2010)
41. If the variable i, j and k hold 123,105.568 and 0.0006 respectively. Find the output
obtained from the following:
a. Printf(“\n5d%8.2f%f”,i,j,k);
b. Printf(“\n%d\n%.1f\n%8.3f”,i,j,k);
c. Printf(“\n%2d\n%e\n%e”,i,j,k);
d. Printf(“\n%d\n%.2e%.4f”,i,j,k); (04)(Jul/Aug 2005)
42. Give the basic structure of a C program and explain with an example to find the
area and circumference of a circle of radius ‘r’. Give the purpose of each line in the
program. (08) (Jul/Aug 2003)
43. Write the structure of C program for an example of finding largest of three given
integer values. (08) (Jul/Aug 2004)
28
Computer Concepts and C Programming 2016-17
i) Token
ii) Keyword
iii) Identifier
iv) Variable
45. Can you write a c program without using main function and explain in detail?
46. Can you propose atleast 3 alternatives to find whether the given number is odd or even
with appropriate algorithms and flowcharts?
47. How to calculate the square root of a number in c programming source code.
48. Analyze cyclic property of data type in c? Explain with any example.
49. “C supports rich set of data types” justify this statement.
50. Distinguish between string constant and character constant.
51. When do you say a variable is valid variable give an appropriate examples.
UNIT-IV
CHAPTER 4: STRUCTUE OF A C PROGRAM
1. a. Choose the correct answers for the following : (04 Marks) ( June/July2013)
i) An operator which acts on two operands to produce result is
operator.
a) Ternary b) binary c) unary d) Complex
ii) The modulus operator (%) can be used only for values.
a) floating b) integer c) both integer and floating d) all
data type
iii) In C, TRUE is represented by
a) True b) zero c) non-zero d) 1
iv) Which of the following is not valid assignment statement ?
a) i + j = 23 b) j = 23 c) j + = 23 d) j = 23 + i
4M ( (dec 2013)
4. Explain in detail about Bitwise operators in C language
6M ( (dec 2013)
5. Write C program to swap values of two integers without using third variable and
give flow chart for the same. (06) ( June/July 2013)
6. Find result of each of the following expressions with I = 4, j = 2, k = 6, a = 2.
i) k * = i + j ii) j = i/ = k iii) i% = i/3
29
Computer Concepts and C Programming 2016-17
8. What do you mean by type conversion? Explain explicit type conversion with
examples. (04) (Jan 2013)
9. Explain the following operators with examples: (09)(Jan 2013)
i) conditional ii) size of iii) Bitwise.
10. Determine the value of a each of the following logical expressions, where a=5,
b=10 and c=-6. (03)(Jan 2013)
i) a>b && a>c ii) b>15 && c<0 || a>0 iii)(a/2.0==0.0&&b/2.0 |=0.0)||c<0.0.
11. What is an expression? Differentiate simple and complex expressions. Mention the
different expression categories.
12. What are the different expression categories? Explain any three expression
categories with examples.
13. Explain postfix and prefix expressions with examples.
14. Explain unary and binary expressions in detail.
15. Explain the precedence and associativity in expressions.
16. What are side effects? Explain with examples, expression with and without side
effects.
17. What is type conversion? What are the different type conversion techniques?
Explain with an example.
18. Explain the different statement types in C.
19. Explain with examples:
i) Increment operators ii) Decrement operators iii) Conditional operators
(Dec 08/Jan 09)
30
Computer Concepts and C Programming 2016-17
20. Evaluate each of the following expressions independent of each other. The
declaration and initialization statement is int i=3, j=4, k=2;
a. i++ - j--
b. ++k % --j
c. j + 1/i –1
d. j++ / i— (08) (Jan/Feb 2003)
21. In the following expression, write the hierarchy of computation and also mention
the type of operator
a*x*x + b*x - c/d >= && z!=15.0 (04)(Jan/Feb 2003)
22. What would be the value of an expression after the execution of the following
expressions. Assume the initial value of a=5
a. a+ = (a++) + (++a)
b. a = (--a) – (a--) (08)(Feb/mar 2005)
23. Write the expressions in C language and evaluate the arithmetic expressions,
i) b (a+b)2 ii) 2ab
a2 (a-b) a+b (06) (Jul/Aug 2003)
24. Write C expression corresponding to the following (Assume all quantities are of
type float) (06)(Jan/Feb 2004)
i) ax+b ii) 2x+3y iii) x5+10x4+8x3+4x+2 iv) (4x+3)(2y+2z+4) v) a
ax-b x-6 b(b-a)
25. Find the values of variable x and m after the execution of the following statements
i) x=15 ii) x=15
m=x++; m=++x; (02) (Jul/Aug 2005)
26. Find the values of the variables in the following program segment
a. int a, b, c; b. int a,b:
float x,y; float x:
a=10; a=25/10+6.5;
b=15; b=25/10+6.6;
c=b/a; c=25/10+6.6;
x=b/a;
y=(float)b/d; (06)(Jul/Aug 2005)
31
Computer Concepts and C Programming 2016-17
UNIT-V
32
Computer Concepts and C Programming 2016-17
CHAPTER 5: FUNCTIONS
1. Choose the correct answers for the following : (04 Marks) (Dec 2013/Jan
2014)
i. The function that calls itself is called as
a) forwarding function b) conditional function
c) recursive function d) background function
ii. The main() work is defined in library
a) stdio.h b) conio.h c) string.h d) math.h
2. What is function? Describe with declaration syntax? (04 Marks) (Dec 2013/Jan
2014)
3. Describe the two ways of passing parameters to function with example? (08
Marks) (Dec 2013/Jan 2014)
4. write a program to test whether or not a given integer number is prime with
function? (04 Marks) (Dec 2013/Jan 2014)
5. a. Choose the correct answers for the following : (04 Marks) ( June/July
2013) i) In c, default return type of function is .
a) void b) int c) float d) char
ii) Parameters used in function call are parameters.
a) Formal b) local c) dummy d) actual
33
Computer Concepts and C Programming 2016-17
10. Explain the elements of user defined functions. (06) (Jan 2013)
11. Write a function prime that returns 1, if its argument is a prime number and
returns O. Otherwise using the same function, write a program to check whether
the number is prime or not (05) (Jan 2013)
12. Write a note on parameter passing technique. (05)(Jan 2013)
13. What is a function? Give the structure chart for a C program and also explain the
function concept.
14. What are User Defined Functions and Library Functions? Can you make a
distinction between them?
15. Explain in detail the basic function designs with examples.
16. Write a C program to find the square of a given number using both UDFs and
library function.
17. What is function definition? Explain with example.
18. What are the elements of user defined functions?
19. What is calling function and what is called function? Can you make a distinction
between them?
20. Explain in detail about function declaration.
21. Explain in detail about function call.
22. What are formal and actual parameters? What is the difference between them?
23. Describe about the Inter-function communication using the different dataflow
strategies.
24. With examples, explain the different ways of passing parameters to a function
34
Computer Concepts and C Programming 2016-17
31. Write a user defined function to find the product of two matrices of order (nxn)
and use it in a main function to compute A 3 +A2 +A, where ‘A’ is a matrix of order
(nxn). (20) (Dec 08/ Jan 09)
UNIT-VI
CHAPTER 5, 6: SELECTION-MAKING DECISIONS, REPETITION
1. Choose the correct answers for the following : (04)(Jan 2014)
35
Computer Concepts and C Programming 2016-17
2. write and explain the declaration systax for while and do-while loop? (04 Marks)
(Dec 2013/Jan 2014)
3. write a C program to compute sum of n numbers? (06 Marks) (Dec 2013/Jan
2014)
4. write a program to check whether the given alphabet is vowel or not using switch
statement? (06 Marks) (Dec 2013/Jan 2014)
5. Choose the correct answers for the following : (04)(June/July 2013)
i) break statement can be used in .
a) if b) if – else c) nested if d) while
ii) Which of the following is not comparator operator in C ?
a) < b) > c) = d) !=
iii) What is the output if following loop is executed ?
for( i = 1; i < 5; i++); printf(“VTU”);
a) syntax error b) VTU
c) VTUVTUVTUVTUVTU d) infinite times
6. Write C program to find roots of quadratic equation. Consider all possible cases of
roots. (06) ( June/July 2013)
7. Write C program to evaluate following expression :
answer = 1 + x + (x2)/2! + (x3)/3! + (x4)/4! + ……… using function.
(06) (June/July 2013)
36
Computer Concepts and C Programming 2016-17
8. Differentiate pre – test and post-test loops. Illustrate your answer with a suitable
example. (04) ( June/July 2013)
9. Choose the correct answer: (04) (Jan 2013)
i) Multi way decision making using _
(A) if (B) for (C) while (D) switch
ii) 5>3? Printf(“hello”:printf(“C”);
(A) hello (B)C (C) hello C (D) None
iii) The result of an expression 2>8 && 2<8 is
(A) True (B) False (C) 10 (D) 20
iv) Size of (float) is
(A) 2 (B) 4 (C) 8 (D) 1
10. Explain switch statement with flowchart and write a program to display name a
day in week for the given day number, assume day one is Monday. (06) (Jan
2013)
11. Write a program to find the given number palindrome or not using while loop
(05) (Jan 2013)
12. Write a program to find a square of a given number using for loop.
(05)(Jan2013)
13. What are Logical operators? Explain the different logical operators in C.
14. Explain the following operators with examples
a. Logical operators
b. Relational operators
c. Conditional operators (06) (Jul/Aug 2003)
15. Explain the different Comparative operators in C?
16. Explain in detail Two-way selection in C.
17. What is an if-statement? What are the varieties of if-statements? Explain along
with syntax? (08) (Jan 2007)
18. Write a C program for the following using different branching statements,
a. To check for even number.
b. To find largest of three numbers.
19. Write a C program to calculate area of circle, rectangle and triangle using switch.
(10) (July 2007)
37
Computer Concepts and C Programming 2016-17
20. Write a program to find the roots of Quadratic equation. Check for all error
conditions. (06) (Dec 08/ Jan 09)
21. Write an algorithm and flowchart to find the largest of three numbers. Write the
corresponding C program.
22. Write a program to check whether the given number is positive, negative or zero
number. Write the algorithm or flowchart for the same.
23. Write a program to check whether the given number is odd or even. Write the
algorithm or flowchart for the same.
24. What are Conditional expressions? Explain with examples.
25. Explain in detail Multiway selection in C.
26. With an example, explain switch statement and significance of break in switch
block (10) (Dec 08/ Jan 09)
27. Write a C program to simulate a simple calculator using else-if ladder and switch
statement.
28. Write a C program to read three integers and print the largest using nested if
statement. If all the three integers are equal, appropriate message must be
displayed. (08)(May/June 2010)
29. What is a loop control expression? Explain Pretest and Post-test loops with
examples.
30. Explain Loop Initialization and Loop Updating.
31. Compare Pretest and Post-test loops.
32. What is a for loop? Explain with syntax, flowchart and example. Give the working
of for loop. (08) (Jan 2007)
33. Explain while-loop along with syntax.
34. Explain do-while statement along with syntax.
35. Differentiate between while and do- while loops. Give one example for each
(08)(July 2007)
36. What is Comma expression? Explain with an example.
37. Explain break statement in C. (05) (July 2007)
38. Differentiate between Break and Continue statements in C.
39. Write a ‘C’ program to find whether a given integer is prime. Use FOR loop.
38
Computer Concepts and C Programming 2016-17
i) 1
2 2
3 3 3
4 4 4 4
i) 1
2 3
4 5 6
39
Computer Concepts and C Programming 2016-17
7 8 9 10
50. Explain the different Looping Applications.
51. What is Recursion? Explain a simple problem using Recursive and Iterative
solution.
52. What is Recursion? Explain the Tower of Hanoi problem and give a recursive
solution for the same.
53. Can you propose an alternative program to grade the student based on his marks
scored in exam without using if-else condition?
UNIT-VII
CHAPTER 13: ARRAYS, STRING
1) Choose the correct answers for the following. (04 Marks) (Dec 2013/Jan
2014)
i) In an Array a[5]={10,20,30,40,50}; The element 40 is designated as
a) a[0] b) a[1] c) a[3] d) a[4]
ii) In an Array int a[2][3]={10,20,30,40,50,60}; The array a[0][1] element is
a) 10 b) 40 c) 60 d) 20
iii) Which of the following string handling function is used to add two strings
a) strcat() b) strncat() c) strcmp() d) strlwr()
iv) Which of the following string handling function is used to compare two strings
a) strlen() b) strcmp() c)strcpy() d) strrev()
2) Write a program to test whether the given string is a palindrome or not. (05
Marks) (Dec 2013/Jan 2014)
3) Write a program to read two matrices from keyboard and print the sum of two
matrices. (07 Marks) (Dec 2013/Jan 2014)
4) Define an array. How are they declared in C language? (04Marks) (Dec
2013/Jan 2014)
5) Choose the correct answers for the following : (04)( June/July 2013)
40
Computer Concepts and C Programming 2016-17
9) Illustrate, how a 1-dimensional array can be declared and initialized, apply array
concept to write a C program to add all the ‘n’ elements of an array.
(06) (Jan 2013)
10)Explain the following string handling functions, with examples: i) strcat ii) strcpy
(04) (Jan 2013)
11) Write a C program to
multiply A[M X N] and B[p X Q] matrices and stores the resultin C matrix.
(06) (Jan 2013)
41
Computer Concepts and C Programming 2016-17
42
Computer Concepts and C Programming 2016-17
43
Computer Concepts and C Programming 2016-17
44