UNIT 1 UNIT 2 UNIT 3 UNIT 4 UNIT 5 UNIT 6 UNIT 7 UNIT 8
Home Online Quiz Lab Programs Previous Questions Resources Glossary Syllabus Faculty Team

Latest News

Lesson PPTs have been uploaded to Resources Section.


Teaching material,Tutorials and Practice problems of all UNIT's are added.


ebooks have been uploaded to Resources Section.



UNIT 2


TOPICS TO BE COVERED IN THIS UNIT:

  1. Designing structured programs
  2. Functions - basics, parameter passing
  3. Storage classes- extern, auto, register, static
  4. Scope rules and block structure
  5. User defined functions
  6. Standard Library functions
  7. Recursive functions
  8. Header files
  9. C preprocessor


TEACHING MATERIAL

Unit 2 Teaching Aids - Click Here


TUTORIAL MATERIAL

Tutorial 1


  1. Give the pictorial representation of different symbols used in flowchart and when it is used?
  2. Write an algorithm/ pseudo code for multiplication of three given numbers?
  3. Write an algorithm for given problems.
    1. Calculate the simple interest formula I =PNR / 100 (where P- price, N- number of years, R- Rate of Interest)
    2. Find out the Area and Perimeter of a circle.
  4. Name different sections used in structure of a 'C' program by using arrows.K
             #include ---------------->
             Int  s = 1;------------------------------>
            main()-------------------------------->
                {
                    Int a, b;------------------------------>
                   Printf("enter a&b values");
                   Scanf("%d%d", &a, &b,&c);                    }---> 
                   S=add(a, b,c);
                   Printf("product is %d", S);
                }
            add(int x, int y,int z)
               {
                    s=a+b+c; }-------->
                   return(s);
               }
    

Tutorial 2



  1. Indentify which one is a Reserved word, Identifier, Constants, Variables.
    Height	perimeter	'8'	0
    Avg	 "Hello"	10	5.52 
    Sum	"India"	x	#define N 10
    Area	'a'	y	# define a 15
    Auto	sizeof		goto	default
    
  2. main()
    {
      int i = 3
      printf("%d", i);
      printf("%d", i++);
      printf("%d", i++);
      printf("%d", ++i);
      printf("%d",++i);
      printf("%d", i++);
    }
    
    What is the output?

  3. Do the following:.
    1. Read int x & int y values and o/p c = 2a+3b. Implement that by using scanf & Printf statement.
    2. (1.) Condition 3 > 2 . (2.) print True or False. Implement that using conditional operator.
  4. Name different types of operators?

Tutorial 3



  1. Write a program by using following conditions. Read input value X.
    If x = 0 	print output value y = 0;
    If x < 1	print output value y = -1;
    If x > 1 	print output value y = 1;
    
  2. Read the value of age, if age>17 print eligible for voting otherwise print not eligible.
  3. Write a program to find the roots of quadratic equation using if - else condition?
  4. Write a program to find the largest of 3 numbers using nested if - else statement?
  5.  main()
      {
        Int   i,j;
        for(i=1;i<=10;i++)
        for(j=1;j<=3;j++)
           {
             If (i>3)
                 break;
            Printf("%d%d",i,j);
           }
       Printf("comes out of the loop");
      }
     
    What is the output?
  6.  main( )
      {
       Int  x;
       Printf("enter a number");
       Scanf("%d",&x);
       If (x%2==0)
            Goto even;
       Else
            Goto odd;
       Even:printf("no is even");
       Odd :printf("no is odd");
      }
      
    Find the output when
    a) x=12;
    b )x=27;

Tutorial 4



  1. Read two values a & b. Now write a program to perform Addition, Subtraction, Multiplication and Division of two numbers using switch.
  2. Write a program to display 1 to 20 numbers.
    1. Using while loop
    2. Using do - while.
    3. Using for - loop.
  3. 3. Write a program to implement nth table to the given number
    1. Using while loop
    2. Using do - while.
    3. Using for -loop.


PRACTICE PROBLEMS

Beginner Problems


  1. What is the output of the following program?
  2.      	  int a=5;
      	  void main()
      	   {
         	    int a=10;
        	    printf("%d",a);
          	   }
    
  3. Write a program to add two numbers by using functions. (The function should take parameters and return a value)
  4. Write a c program to find factorial of a number by using recursive function.
  5. Write a program to find mn using library function
  6. Write a program to swap two numbers by using call by address.
  7. What is the output of the following program?
  8.         
            void show();
    	main()
    	 {
     	  show();
      	  show();
      	  show();
    	 }
    	void show()
    	 {
     	  static int i=0;
      	  i++;
     	  printf("%d",i);
    	 }
    
  9. What is the output of the following program?
  10. 	main()
    	 {
       	  int i=9;
       	   {
         	    int i=8;
    	    printf("%d",i);
      	   }
      	  printf("%d",i);
             }
    

Intermediate Problems


  1. Write a program to find sum of given series by using function with argument and return value. e = 2 + 3/1! - 6/2! + 9/3! - 12/4! .....!
  2. Write a Program to find GCD of 2 numbers using recursion.
  3. Write a program to generate Fibonacci numbers using recursion.
  4. Program to solve Towers of Hanoi problem using recursion.
  5. What is the output of the following program?
  6.    
          #include 
          #define a 10
          main()
           {
            #define a 50
            printf("%d",a);
           }
    
  7. What is the output of the following program?
  8.        main()
     	{
     	 extern out;
     	 printf("%d", out);
    	}
     	int out=100;
    
  9. What is the output of the following program?
  10.         int a,b;
    	void swap(int,int);
    	main()
    	 {
       	  a=5;
       	  b=10;
       	  clrscr();
       	  swap(a,b);
       	  printf("%d  %d",a,b);
    	 }
    	void swap(int a, int  b)
    	 {
       	  int t;
       	  t=a;
       	  a=b;
       	  b=t;
    	 }
    

Advanced Problems


  1. What is the output of the following program
  2.   	#define mul(x) x*x
     	void main()
     	 {
     	  int m;
      	  clrscr();
      	  m=mul(4+3);
      	  printf("%d" ,m);
     	 }
    
  3. What is the output of the following program
  4.  	 #define square(x) x*x
    	 main()
              {
    	   int i;
    	   i=64/square(4);
    	   printf("%d",i);
    	  }
    
  5. #define f(g,g2) g##g2
  6.       main()
           {
    	int var12=100;
    	printf("%d",f(var,12));
           }
    
  7. What is wrong with this program.
  8.        main()
    	{
    	 register int a=2;
    	 printf("Address of a = %d",&a);
    	 printf("Value of a   = %d",a);
    	}
    
  9. What is the output of the following program.
  10.         #define FALSE -1
    	#define TRUE   1
    	#define NULL   0
    	main()
              {
    	   if(NULL)
    	   puts("NULL");
    	   else if(FALSE)
    	   puts("TRUE");
    	   else	
    	   puts("FALSE");
    	  }
    
  11. What is the output of the following program.
  12.          main()
    	  {
    	   static int var = 5;
    	   printf("%d ",var--);
    	   if(var)
    	   main();
    	  }
    

This Page Is Designed By Mohan Ajay Kumar

Copyright (c) Aditya Engineering Colleges, Surampalem. All rights reserved.
Development Team