Search This Blog

Thursday, June 7, 2012

C/C++ Programming Placement Papers Questions (C Quiz - 4)

1. Which of the following is not true about an Integer Constant in ‘C’ programming language?
[A]It should have at least one digit
[B]It must not have a decimal point
[C]Commas or blanks are allowed within an Integer Constant
[D]It can be either positive or negative


2. Which of the following is not true about static variable in ‘C’ language?
[A]It is stored in memory
[B]Its default initial value is zero
[C]Value of the variable persists between different function calls
[D]It is initialized more than once in a program


3. Class(es) of data types supported by ANSI C is/are
I. User defined data types.
II. Empty data set.
III. Derived data types.
[A]Only (I) above
[B]Only (II) above
[C]Both (I) and (II) above
[D]All (I), (II) and (III) above


4. Which of the following statements in ‘C’ programming language tests the value of a given variable against a list of case values and when a match is found, a block of statements associated with that case is executed?
[A]Switch
[B]Break
[C]Case
[D]If-else-if


5. Which of the following decision-making statements is used in a “C” program when it is necessary to execute the body of the loop before the test is performed?
[A]The if statement
[B]The if-else statement
[C]The switch statement
[D]The do statement


6. Which function is used to read an integer to a file in a “C” program?
[A]getc()
[B]putc()
[C]getw()
[D]putw()


7. The difference between structures and unions used in a “C” program is
I. Structure is a method for packing data of different types whereas union is used for packing data of same type.
II. In Structures, each member has its own storage location whereas all the members of a union use the same location.
III. A Structure is declared using the key word ‘struct’ whereas union is declared using the keyword ‘union’.
[A]Only (I) above
[B]Only (II) above
[C]Both (I) and (III) above
[D]Both (II) and (III) above


8. The “ % ” symbol used in the statement of “C” program is a
[A]Decision character
[B]Conversion character
[C]Data type character
[D]Printable character


9. Which of the following is a user-defined function in “C” language?
[A]main ()
[B]printf ()
[C]scanf ()
[D]fprintf ()


10. Mr. Ravi, writing a ‘C’ program, wants to print the student name, enrollment number and marks of 10 students. So, which of the following can be used to group these data items of different data types under a common name?
[A]Loop
[B]Structure
[C]Array
[D]Storage Class


11. Sandra, an experienced ‘C’ programmer wants to develop a new application for Bus reservation system. The application uses 20 variables and 40 functions. In which of the following ways does she have to define variables to retain their values even after the control is transferred to the calling function?
[A]Auto
[B]Static
[C]Extern
[D]Register


12. Mr. Bawachi, wrote a ‘C’ program for displaying first 20 even numbers. But after executing the program the answer was shown with decimal numbers. Which of the following data type characters was used in the program for printing?
[A]% f
[B]% x
[C]% h
[D]% i


13. In a ‘C’ program, Mr. Narendra used three variables and one of them is ‘int’. After the compilation, the syntax error was shown. So which of the following rules with respect to variables in C language is violated?
[A]Variables should begin with a letter
[B]Variables are case sensitive
[C]Variable names should not be keywords
[D]Spaces are not allowed


14. Mr. Gopal, working on a ‘C’ program has to test more than one condition to arrive at the right decision. So which of the following operators will be helpful for him?
[A]Increment operators
[B]Bitwise operators
[C]Arithmetic operators
[D]Logical operators


15. Which of the following statements in ‘C’ language will help Mr. Surya, to test the value of a given variable against a list of case values and when a match is found, a block of statements associated with that case is executed?
[A]switch
[B]break
[C]for
[D]while


0 comments: