Friday, November 30, 2018

CP Questions R15 JNTUA UNIT III,IV and V


UNIT-III 2 Marks
1.       Explain call by reference.
2.       What does this statement indicate p = **a; where p and a are variables?
3.       How many maximum arguments can be passes by return ( )?
4.       Define type qualifiers
5.       Give syntax to create a pointer to function.
6.       Explain malloc() function.
7.       Write a C program for call by reference.
8.       What is pointer? Give its General form.
9.       What is meant by storage class of variable?
10.   Write a function to swap two integer elements.
UNIT-III 10 Marks
1.       Explain pointers and arrays with some example programs.
2.       Discuss the problems associated with pointers.
3.       Define Pointer. Write a C program to find the sum of the all elements in given array using pointers.
4.       Define scope. Briefly explain the scope, life time and visibility of Identifier.
5.       List the different storage classes in C and explain each one of them.
6.       Write a C program to exchange the value of two integers using call by reference.
7.       Give a detailed note on pointer expressions.
8.       List and explain the storage classes with examples.
9.       What is meant by the scope of variables and summarize types of storage class in C?
10.   Write a program to assign any number at random to an integer variable k and display the same through pointer.
11.   Discuss any two storage class specifiers.
12.   What are the problems with pointers?
13.   Explain dynamic memory allocation functions of C with a suitable example.
14.   Compare call by value with call by reference and explain using a suitable example.
15.   Illustrate with a suitable example the use of return statement.
16.   Write a C program to calculate the sum of all elements of an array using pointers as arguments.
17.   What is a pointer? Write a program in C to reflect the concept of pointers to functions.                 
UNIT-IV 2 Marks
1.       Define command line arguments.
2.       What is the role of stack in recursion?
3.       Declare a struct name containing field’s first_name, middle_name, last_name within a struct student.
4.       Differentiate between structure and unions.

5.       Define function prototype. Give the general syntax of function prototype.
6.       Why do we need structures?
7.       Why to use typedef?
8.       Write any two differences between union and structure.
UNIT-IV 10 Marks
1.       Write a recursive function in C to find the sum of array elements.
2.       Write a program using command line to print the statement “I am proud of my country”.
3.       Define structures. Write a C program using functions to return the sum of two complex numbers passed as parameters.
4.       Explain enumerated data types with an example.
5.       Define union. Differentiate between union and structures.
6.       With an example program, explain structure within structure.
7.       Explain the following:(i) Structure with in structure.(ii) Self reference structure.
8.       How to pass the structures to functions as an argument? Explain with a suitable example.
9.       What is the difference between a structure declaration and a structure initialization?
10.   Define a function & explain why function prototype is essential
11.   Illustrate the need of structures with an example.
12.   Write a C program to demonstrate the use of array of structures.
13.   What is union? Write a C program to store information in a union and display it
14.   Illustrate recursion with an example.
15.   Explain all the function prototypes with examples.
16.   Demonstrate with a suitable example, the use of structure within a structure.
UNIT-V 2 Marks
1.       Define a file.
2.       How to define a global constant?
3.       Write a statement to open a file in reading mode.
4.       Define Stream. List different types of Streams.
5.       What is the problem with getchar ()?
6.       Discuss the types of streams.
7.       What is a pre-processor?
8.       Write different built-in (library) functions provided by ‘C’ language for handling I/O operations on files.
9.       What is the use of the preprocessor directives?
UNIT-V 10 Marks
1.       Explain FILE structure in detail.
2.       Describe formatted input output statements.
3.       Explain fprintf() and fscanf() functions with an example program.
4.       Define Preprocessor directives. Discuss Marco replacement with an example.
5.       Write a C program that reads characters from the keyboard and writes them to a disk file until the user types a dollar sign.
6.       Describe the following file functions.
(a)    fopen().(b) fclose().(c) getc(). (d) putc(). (e) feof().
7.       How to use fseek() for random access of the file content?
8.       What role does the fseek() plays and how many arguments does it Have?
9.       What are the features of C preprocessor? Give the differences between macros and functions
10.   Write a sample C program to demonstrate the control string of scanf() function.
11.   Write a C program to read name and marks of N number of students from user and store them in a file.
12.   Write a C program to demonstrate the use of fscanf and fprintf functions.
13.   Write a program in C to illustrate the use of rewind and fseek functions.
14.   Write a program in C that reads files and displays them on the screen.


CP Questions R15 JNTUA UNIT I and II


UNIT-I      2 MARKS
1.                   With the help of neat sketch, explain the bitwise shift – right operator. 
2.                   Draw and explain the truth table for bitwise exclusive OR operator.
3.                   What is type definition? Illustration it with its syntax and example.
4.                   Define flowchart. Describe the symbols used for representing reading and decision making statements.
5.                   What is system software? Give examples.
6.                   Define algorithm and given an example.
7.                   What are the various basic data types in C?
8.                   Write the syntax for conditional operator.
UNIT-I     10 MARKS
1.       Define a computer? explain its types and its application areas?
2.                    what is a software and briefly describe its types
3.                    Write in detailed note about C data types ?
4.                    Explain about relational operator with an example program ?
5.                    Draw the block diagram of the computer and explain its hardware components ?
6.                    Define an algorithm and write various classifications of algorithms and explain them ?
7.                    Define a constant and explain its types? Write a C program to evaluate area of rectangle?
8.                    Discuss about following operators (a) increment  and decrement  (b) Logical
9.                    Explain software development method and apply SDLC with example?
10.                Define flow chart and what are the various symbols used in flowchart explain briefly ?
11.                What is variable, how it is declared and initialized? write a c program to find the average of three numbers?
12.                Explain about the following operators with example (a) ternary operator(b) bit-wise operators?
UNIT-II      2 MARKS
1.       Distinguish between while and do – while loops.
2.                   Differentiate between while loop and do while loop.
3.                   Define Array. Write the declaration of Multi Dimensional Array.
4.                   What is rvalue? Give one example.
5.                   Write the syntax of conditional operator and explain its operation with an example.
6.                   With an example distinguish between break and continue statement.
7.                   What is the purpose of strstr()? Give its syntax.
8.                   Briefly describe the iterative statements.
9.                   How do you declare and initialize a multidimensional array? Give an example.
10.                Mention the purpose of the functions strset() and strcpy().
                                          UNIT-II      10 MARKS

1.       Discuss in detail about the various string manipulation functions 
2.                   Write a program to print the Fibonacci sequence of any given number.
3.                   Write a program to calculate the GCD of  given two numbers.
4.                   What is an array? Explain the one dimensional array with suitable example program.
5.                   Write a program to enter a number and then calculate the sum of its digits.
6.                   With the help of syntax and flowchart, explain any two iterative statements.
7.                   Write a program that accepts a number from 1 to 10. Print whether the number is even or odd by using switch case construct. 
8.                   Discuss in detail about the two dimensional arrays.    
9.                   Write a program to display whether any given string is a palindrome or not.
10.                Write a C program to check whether a given number is Armstrong number or not. 
11.                Describe the Multiway selection statements in C with examples.
12.                Write the algorithm for converting a character into a number.
13.                Write a C program for matrix multiplication.
14.                Discuss the following functions: (i) Strstr ().  (ii) Strest ( ).  (iii) strrev ( ).
(iv) strcmpi ( ).  (v) strncmpi ( ).
15.                Differentiate between elseif and switch statements with examples.
16.                Write a C program to add two matrices.
17.                Write a C program to sort a list of names.
18.                Explain various branching statements in C with examples
19.                Design an algorithm to compute n factorial (n! ) where n>=0 
20.                Describe the purpose of break and continue statements in C.
21.                What is recursion? Explain with example. Also give the advantages and disadvantages.
22.                List and explain loop control statements in C.
23.                Write a C program to find the kth smallest in the given array.
24.                Discuss any five string handling functions.                                                        
25.                Why should we avoid using goto statement in programming? How it is different from continue statement? Explain with examples.
26.                Write the algorithm to check whether a given number is prime or not.
27.                How do you declare a two dimensional array? Give its memory representation.


Friday, November 16, 2018

Even and odd numbers among set of numbers


#include <stdio.h>

void main()
 {
    int arr1[10], arr2[10], arr3[10];
    int i,j=0,k=0,n;


     
       printf("------------------------------------------------------\n");

       printf("Input the number of elements to be stored in the array :");
       scanf("%d",&n);
   printf("Input %d elements in the array :\n",n);
       for(i=0;i<n;i++)
            {
      printf("element - %d : ",i);
      scanf("%d",&arr1[i]);
    }

    for(i=0;i<n;i++)
    {
if (arr1[i]%2 == 0)
{
   arr2[j] = arr1[i];
   j++;
}
else{
   arr3[k] = arr1[i];
   k++;
}
    }

    printf("\nThe Even elements are : \n");
    for(i=0;i<j;i++)
    {
printf("%d ",arr2[i]);
    }

    printf("\nThe Odd elements are :\n");
    {for(i=0;i<k;i++)
    {
printf("%d ", arr3[i]);
    }
    printf("\n\n");
 }
------------------------------------------------------                                                       
Input the number of elements to be stored in the array :5                                                   
Input 5 elements in the array :                                                                             
element - 0 : 25                                                                                             
element - 1 : 47                                                                                             
element - 2 : 42                                                                                             
element - 3 : 56                                                                                             
element - 4 : 32                                                                                             
                                                                                                             
The Even elements are :                                                                                     
42 56 32                                                                                                     
The Odd elements are :                                                                                       
25 47

Sunday, November 11, 2018

Computer Programming Objective and Descriptive for II MID 2018-19


UNIT-III
1.___________is a variable which stores address of another variable.
a)pointer b)static variable c)register variable d)none
2._______________can be defined as assigning an  address of a variable to a pointer
a)pointer initialization b)pointer assignment c)multiple indirection d)pointer arithmetic
3. which of the following are correct syntax to pass array as parameter to function
a)func(&array)    b)func(#array) c)func(*array)   d)none
4)the statement which is used to make a function call is _________
a)functionnameb)fucntionname() c)function(parameters) d)all
5)__________are the arguments which are present in function prototype
a)actual b)formal c)both d)none
6)in________approach the address of the values are passed as an arguments to a function
a)call by value b)call by reference  c)both )none
7)in __________method we pass a value as a parameter to a function
a)call by value b)call by reference  c)both )none
8__________can be defined as length of the time that the variable retains its value
a)scope b)lifetime c)visibility d)all
9._________is th e default storage class for local variables
a)static b)auto c)extern d)none
10.________controles how the variables may be accessed or modified
a)type qualifiers b)storage classes c)both )none
11.________is the type qualifier that only applied to  only pointers
a)volatile b)restrict  c)both d)none
12_______is the value that can be unchanged during the execution  of a program
a)constant b)variable c)constint a d)a and c
13)______________can be defined as the part of the program that the object is visible
a)scope b)visibility  b)lifetime c)program
14)actual code of the function can be called as ____
a)function definition b)function call c)prototype d)all
UNIT-IV
1.                   Structure is a  deriveddatatype[          ]
a)derived    b)self   c)referential    d)array
       2.   structure declaration always starts with struct keyword
                a)tag   b)member   c)struct     d)none
       3. A Structure that itself contains another structure isNested structure
                a) loop b)format structure  c)array structure  d)Nested structure
        4. In array structure  every element  is  of - structure type 
                a)Type def b)structure type  c)object type  d)none
        5. Typedef used to redefineprimitive datatype
a)dataname   b)struct     c)primitive datatype  d)none
         6. Bitfield is a structure members that contains  bits
a)data    b) values    c) members    d) bits
7.By using  enumerated datatypes we can create- owndatatype
                a) tag name b) enum  c) owndatatype d) primitive datatype
8.which have same memory locations Union
                a)Union b) structure c) array d)pointer
9.When main has parameters they are known as  -- commandline arguments
                a)argc    b)argv  c)command  d)commandline arguments
         10.NO.of elements in the command line argument are define in--argc--
                a)argc b)argv c) command  d)typedef
        11.AProtype helps the compiler to check -returntype,argumenttype
                a)returntype,argumenttype    b)argumentlist   c)list,value d) none
        12.Function which call itself is known as Recursive function
                a) recursive function b)structure function c)function prototype d)none
       13.keyword for union is union
a)structure b) union c) typedef d) tag name
14.In arrays Bitfields are not permitted
a)bitfields b) structures c) typedef d) none
15.In structure and functions  structure member variables are passed to a function
a)call by value b)call by reference c) address d)none
UNIT-IV
1.       When preprocessor is to be compiled________                                                                               [      A     ]
(a)Before a program compiled  (b)After a program compiled (c) middle of the program (d) none
2.       What is the symbol is used before preprocessor directive start_______                                [    b        ]
(a)&      (b) #   (c) @    (d) *
3.       What is the full form for ANSI ________                                                                                              [    A       ]
(a)American National Standards Institute (b) American National Standards India
(c) American National Syntax  Institute  (d)          none
4.       Which of the following is formatted I/O statements _________                                               [    C        ]
(a)put()                                (b)puts()             (c) scanf()           (d)get()
5.       Which of the following is unformatted I/O statements  ________                            [       C     ]
(a)scanf()            ()printf()              (c)gets()               (d)none
6.       ______function is used to display information of any type of data to the screen[     a      ]
(a)printf()        (b)scanf()                                (c)sscanf()                           (d)none
7.       ________function is used to read all the type of data from keyboard.                   [   b         ]
(a) printf ()          (b)scanf()            (c) fprintf()         (d) none
8.       A _______ is a sequence of characters                                                                                  [     a       ]
(a)text stream   (b)bit stream  (c) byte stream  (d) string stream
9.       A ______is a sequence of bytes that has a one-to-one correspondence to the bytes in the external device                                                                                                                                         [     d       ]
(a)text stream   (b)bit stream  (c) byte stream  (d) binary stream
10.   The ______function resets the file position indicator to the beginning of the file specified as its argument.                                                                                                                                          [      b      ]
(a)seek()             (b)rewind( )                       (c) fseek()                           (d)close()


UNIT-III 10MARKS
1.       What is a function? Explain about call by value & Call by reference with example?
2.       List and Describe the Dynamic allocation functions?
3.       What are the different Storage classes in ‘C’ explain?
  UNIT-III 2 MARKS
4.       What is function prototype and write the syntax?
5.       Storage Class Specifiers?
6.       Function argument Types? .
7.       List out Dynamic Memory Allocation functions?  
UNIT-IV 10 MARKS
1.       What is command line argument explain with example?
2.       What is a Structure Explain how to declare, initialize, access the structure element?
3.       Write a recursive program to print the factorial value of any given integer?
4.       Give the difference between Structure and Union?
5.       Explain about how to pass structure to function?
6.       Discuss Passing Pointer to a Function with example?
UNIT-IV 2 MARKS
1.       Define pointer and its initialization of pointers?
2.       What is recursion?
3.       What is enumerated data type with example?
4.       what are the Problems with Pointers?
5.       What is multiple indirections?
6.       What is typedef and write the syntax and example
7.       Define nested structure with example?
UNIT-V     10  MARKS

1.       Explain in Detail about various types of unformatted input and output functions with example?
2.       Explain about preprocessor directives?
3.       Write an example program to fprintf(),and fscanf() file handling functions?
4.       explain about file operations in C?
5.       Explain about fseek(),rewind(),ftell() with syntax ?
UNIT-V     2 MARKS
6.       what is file and list out file modes?
7.       List the operations performed on files?
8.       Difference between putchar() and puts()?
9.       List out the Function for formatted Console I/o?