Thursday, November 18, 2010

C Programming Unit wise Important Questions

DJR Institute of Engineering & Technology
                                      C Programming Unit wise Important Questions
     UNIT-1:
  1. a) What is the difference between signed integer and unsigned integer in terms of memory and range?
     b) List the entire data types in ‘C’. What is the size of these data types?
     c) Explain about pseudo code                                                                 

  1. Write about space requirements for variables of different data types               [6+6+4]

  1. a) What is meant by operator precedence? What are the relative Precedence of the arithmetic operators?
     b) What is the associativity of the arithmetic operators?
     c) How can the value of an expression be converted to a different data Types?
     d) What is unary operator? Explain example for each.                                   [4+4+4+4]

  1. a) What is a string constant? How do string constants differ from character constants? Do string constants represent numerical Values?
     b) Summarize the standard escape sequences in C. Describe them.
     c) What is a variable? How can variables be characterized? Give the rules for variable declaration
     d) What is the purpose of type declarations? What are the components of type declaration?
                                                                                                              [4+4+4+4]
  1. a) Explain the following & illustrate it with an example each.
     i) Increment & Decrement operator
     ii) Conditional operator
     iii) Bitwise operator
     iv) Assignment operator
     b) State the rules that applied while evaluating expression in automatic type conversion.[5+5]

  1. a) Define Algorithm.
     b) What is the use of flowchart?
     c) What are the different steps followed in the program development?          [3+3+10]

  1. a) Explain the working of Unary Operator with example.
     b) Explain the working of Binary Operator with example.
     c) Explain the working of assignment Operator with example.
          d) Explain the working of ternary Operator with example.                          [4+4+4+4]
  1. How algorithm is different from flowchart? Write an algorithm and draw flowchart for finding greatest among three given numbers. [8+8]

  1. Write a ‘C’ program to find area of circle.   [6]

  1.  Write the various steps involved in executing a C program and illustrate it with a help of flowchart.[8]
      
  1. a) What is an expression? What kind of information is represented by an expression?
     b) What is an operator? Describe several different types of operators that are included with in the C language with an example each.                                       [8+8]

  1. a) What is the conditional operator? What is its general syntax?
     b) Write a C program to find the largest of three input numbers using conditional operator. [8+8]

  1. a) What is an algorithm? Write the various criteria used for judging an algorithm.
     b) Write an algorithm to find the roots of quadratic equation for all the cases.            [8+8]


  1. a) What is a flowchart? Explain the different symbols used in a flowchart.
     b) Write a flowchart to find the maximum and minimum of given numbers.         [8+8]

  1.  State the rules that applied while evaluating expression in automatic type conversion      [8]

  1. a) What are the general characteristics of C?
     b) Give and explain the structure of a C program.           [8+8]

  1. a) What are different types of integer constants? What are long integer constants? How do these constants differ from ordinary integer constants? How can they be written and identified?
     b) Describe two different ways that floating-point constants can be written in C.What special rules  
     apply in each case?
     c) What is a character constant? How do character constants differ from numeric type constants? Do character constants represent numerical values?                                              [6+4+6]

  1. What are the different format specfiers available for Input and Output statements? Explain with an example                                     [16]

  1. a) Mention the use of sizeof and pointer operator in ‘C’. Explain then with a program
     b) How comma and member selection operator used in ‘C’. Explain with program [8+8]

  1. Summarize ‘C’ operators precedence and associativity               [16]   
    
  1. Write a ’C’ program which reads temperature in either Fahrenheit or Celsius and compute temperature in the opposite scale. Formulas are C = ( F - 32) * 5/9 , F = 9 (C/5) + 32      [6]

  1. Draw a Flowchart for the following The average score for 3 tests has to be greater than 80 for a candidate to qualify for the interview. Representing the conditional logic for generating reject letters for all candidates who do not get the required average & interview call letters for the others. [10]

  1.  What are the logical operators used in C and illustrate with examples.   [8]

  1.  Explain about the computer system, hardware & software concepts   [16]

  1. Explain about creating and running of the programs                            [16]

  1. Explain about the different types of constants available in ‘C’               [16]   

UNIT-2:
    
  1. What are the different types of control statements available ’C’. Explain them with an example? [16]

  1. Candidates have to score 90 or above in the IQ test to be considered eligible for taking further tests. All candidates who do not clear the IQ test are sent reject letters and others are sent call letters for further tests. Represent the logic for automating this task. [8]

  1. In what way ‘if statement’ is different from switch statement? Write a program using switch statement to manipulate student grade system                   [16]

  1. a) Explain about bitwise logical operators with an example         
     b) Explain about the bitwise shift operators with an example       [8+8]
    
  1. a) Explain about the bitwise rotation operators with an example
     b) Explain about the bitwise masking operators with an example  [8+8]

  1. a) Explain about the switch-case control statement 
     b) Write a program to perform arithmetic operations using switch-case            [8+8]

  1. Write a program to find out the age of person                                   [8]
    
  1. Explain the differences between nested-if and else-if control statements with examples  [16]

  1. Write a program to find out the number of days in a given month [8]

  1. Explain about  the nested switch-case control statement with an example       [16]

UNIT-3:

  1. a) Distinguish between getchar and scanf functions for reading strings
     b) Write a program to count the number of words, lines and characters in a text.       [8+8]

  1. a) What is the purpose of break statement?
     b) Suppose a break statement is included within the innermost of several nested control statements     
         What happens when break statement is executed?

  1. Write a program to print the multiplication table up to with proper format.

  1. Write a program to determine and print the sum of the following harmonic series for a given value of n: 1+1/2+1/3+.....+1/n.

  1. a) What is meant by looping? Describe any two different forms of looping with examples.
     b) Write a program to print the following outputs using for loops:
               1 1
              2 2 2 2
             3 3 3 3 3 3
           4 4 4 4 4 4 4 4                                                                      [8+8]

  1. Write a program to sort the set of strings in an alphabetical order?       [10]

  1. a) Write a ‘C’ program to find the squares of N numbers using do - while.
     b) Write a ‘C’ program to convert Decimal Number to Octal Number. [8+8]

  1. Write a ‘C’ program to convert Decimal to Hexa Decimal number. [10]

  1. Write a program to display the output as follows             [8]
    
     i)        1                                              ii)                                    1
              2        2                                                                  2                  2
              3        3        3                                              3                  3                  3
              4        4        4        4                           4                  4                  4                  4
              5        5        5        5        5        5                  5                  5                  5                  5

  1. a) Describe in detail the execution of while statement with example.
     b) Given a number, write a program using while loop to reverse the digits of the number. For e.g.  
      12345 should be written as 54321.
     c) Write a program to compute the sum of the digits of a given integer number.[4+6+6]


  1. Write a program that calculates the value of money at the end of each year of investment assuming an interest rate of 12 percent and prints the year & corresponding amount in two columns for a period of 10 years with an intial investment of 5 years.
     Formula: Value at end of year = value at start of year (1+interest rate)          [16]

  1. Compare and contrast while and do-while loops with examples                       [16]

  1. Why ‘while statement’ is called as repetition structure? Write a program to find whether number is Armstrong or not                                                                                   [16]

  1. a) Write a ’C’ program to print Pascal Triangle using Binomial Theorem.
     b) Write short notes on goto statement. [10+6]

  1. a) Write a ’C’ program to find greatest common division (GCD) of two given numbers. [10]
     b) Write a  ‘C’ program to find lease common multiple (LCM) of two given numbers       [10]


  1. a) Write a program to display the Fibonacci series of given number of terms    
     b) Write a c program to find the sum of digits in the given number                  [8+8]
  1. Explain about the event control and counter controlled loops with examples     [16]

  1. Explain about the string handling functions with examples                              [16]

  1. Explain the differences between break and continue with example                   [16]

  1. a) Write a c program to check whether the given string is a palindrome or not 
     b) Write a c program to print all the prime numbers list upto given number

  1. a) Write a program to convert a decimal number into binary number     
     b) Write a program to convert a decimal number into octal number

  1. Explain the difference between exit and break with an example
UNIT-4:

  1. The annual examination is conducted for 50 students for three subjects. Write a program to read the data and determine the following:
     (a) Total marks obtained by each student.
     (b) The highest marks in each subject and the Roll No. of the student who secured it.
     (c) The student who obtained the highest total marks.                       [16]

  1. a) In what way array is different from an ordinary variable?
     b) What conditions must be satisfied by the entire elements of any given Array?
     c) What are subscripts? How are they written? What restrictions apply to the Values that can be
         assigned to subscripts?
     d) What advantages is there in defining an array size in terms of a symbolic constant rather than a
         fixed integer quantity?
     e) Write a program to find the largest element in an array.        [3+3+3+3+4]

  1. Write a C program using pointers to read in an array of integers and print its elements in reverse order                                                                                       [8]

  1. How are multidimensional arrays defined? Compare with the manner in which one-dimensional arrays are defined.                                                                  [6]

  1. Define an array. What are the different types of arrays? Explain. [16]

  1. Write the syntax for declaring two - dimensional array write a program to access and print the array elements. [16]

  1. a) Write the program to find the sum of even numbers using arrays. [6]
     b) Write a program to perform addition of two matrices.                   [10]

  1. What is the advantage of using arrays ? Give syntax for declaration , accessing and printing one dimensional array ? [16]

  1. Write a C program to calculate student-wise total for three students using an array of structure.[8]

  1. a) Write a C program to do Matrix Multiplications.
     b) Write in detail about one dimensional and multidimensional arrays. Also write about how initial values can be specified for each type of array?                                                         [8+8]

  1. The annual examination is conducted for 50 students for three subjects. Write a program to read the data and determine the following:
     (a) Total marks obtained by each student.
     (b) The highest marks in each subject and the Roll No. of the student who secured it.
     (c) The student who obtained the highest total marks.                                          [5+6+5]

  1. Write a program to find out the inverse of a matrix                   [16]

  1. a) How are initial values written in a one-dimensional array definition? Is the entire array be initialized? What value is automatically assigned to those array elements not explicitly initialized?
     b) Write a program to calculate mean, variance and standard deviation of n numbers.
     S=sqrt(variance), where Variance = 1/n sum (xi −m)2  M= mean of n numbers.  [8+8]

  1. a) How strings and characters are represented in an array
     b) Write a program to print array of characters                                  [6+10]