int x=40;
main(){
int x=20;
printf("
%d",x);
}
Option A. 40
Option B. 20
Option C. Compilation Error
Option D. Garbeg Value
Question: 2. What will be output if you will compile and execute the following c code?
#include
int main(){
int i=320;
char *ptr=(char *)&i;
printf("%d",*ptr);
return 0;
}
Option A. 1
Option B. 64
Option C. 320
Option D. Compiler Error
Option A. 27
Option B. 343
Option C. 233
Option D. Compiler Error
Question: 4.What will be output if you will compile and execute the following c code?
#include
int main(){
char c=125;
c=c+10;
printf("%d",c);
return 0;
}
Option A. 135
Option B. +INF
Option C. -121
Option D. -135
Question: 5. What will be output if you will compile and execute the following c code?
#include
int main()
{
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
return 0;
}
Option A. Less than
Option B. Equal
Option D. None of above
Question: 6. For 16bit compiler allowable range for integer constants is ______ ?
Option A. 3.4e38 to 3.4e38
Option B. 32767 to 32768
Option C. 32768 to 32767
Option D. 32668 to 32667
Question: 7. C programs are converted into machine language with the help of
Option A. An Editor
Option B. A compiler
Option C. An operating system
Option D. None of the above
Question: 8. A C variable cannot start with
Option A. An alphabet
Option B. A number
Option C. A special symbol other than underscore
Option D. both (b) and (c)
Question: 9. Which of the following is allowed in a C Arithmetic instruction
Option A. []
Option B. {}
Option C. ()
Option D. None of the above
Question: 10. Which of the following shows the correct hierarchy of arithmetic operations in C
Option A. / + *
Option B. * / +
Option C. + / *
Option D. * / + -
Question: 11. What is an array?
Option A. An array is a collection of variables that are of the dissimilar data type.
Option B. An array is a collection of variables that are of the same data type.
Option C. An array is not a collection of variables that are of the same data type.
Option D. None of the above.
Question: 12. What is right way to Initialization array?
Option A. int num[6] = { 2, 4, 12, 5, 45, 5 } ;
Option B. int n{} = { 2, 4, 12, 5, 45, 5 } ;
Option C. int n{6} = { 2< 4< 12 } ;
Option D. int n(6) = { 2, 4, 12, 5, 45, 5 } ;
Question: 13. An array elements are always stored in _________ memory locations.
Option A. Sequential
Option B. Random
Option C. Sequential and Random
Option D. None of the above
Question: 14. What is the right way to access value of structure variable book{ price, page }?
Option A. printf("%d%d", book.price, book.page);
Option B. printf("%d%d", price.book, page.book);
Option C. printf("%d%d"< price::book< page::book);
Option D. printf("%d%d", price>book, page>book);
Question: 15. perror( ) function used to ?
Option A. Work same as printf()
Option B. prints the error message specified by the compiler
Option C. prints the garbage value assigned by the compiler
Option D. None of the above
Question: 16. Bitwise operators can operate upon?
Option A. double and chars
Option B. floats and doubles
Option C. ints and floats
Option D. ints and chars
Question: 17. What is C Tokens?
Option A. The smallest individual units of c program
Option B. The basic element recognized by the compiler
Option C. The largest individual units of program
Option D. A & B Both
Question: 18. What is Keywords?
Option A. Keywords have some predefine meanings and these meanings can be changed.
Option B. Keywords have some unknown meanings and these meanings cannot be changed.
Option C. Keywords have some predefine meanings and these meanings cannot be changed.
Option D. None of the above
Question: 19. If the class name is X, what is the type of its “this” pointer (in a nonstatic, non-const member function)?
Option A. const X* const
Option B. X* const
Option C. X*
Option D. X&
Question: 20. Which classes allow primitive types to be accessed as objects?
Option A. Storage
Option B. Virtual
Option C. Friend
Option D. Wrapper
Question: 21. When is std::bad_alloc exception thrown?
Option A. When new operator cannot allocate memory
Option B. When alloc function fails
Option C. When type requested for new operation is considered bad< thisexception is thrown
Option D. When delete operator cannot delete teh allocated (corrupted) object
Question: 22. Which one of the following is not a fundamental data type in C++
Option A. float
Option B. string
Option C. int
Option D. wchar_t
Question: 23. Which of the following is a valid destructor of the class name "Country"
Option A. int ~Country()
Option B. void Country()
Option C. int ~Country(Country obj)
Option D. void ~Country()
Question: 24. Which of the following correctly describes C++ language?
Option A. Statically typed language
Option B. Dynamically typed language
Option C. Both Statically and dynamically typed language
Option D. Type-less language
Question: 25. Which of the following keyword supports dynamic method resolution?
Option A. abstract
Option B. Virtual
Option C. Dynamic
Option D. Typeid
Question: 26. Which of the following is the most preferred way of throwing and handling exceptions?
Option A. Throw by value and catch by reference.
Option B. Throw by reference and catch by reference.
Option C. Throw by value and catch by value
Option D. Throw the pointer value and provide catch for teh pointer type.
Question: 27. Which of the following is not true about preprocessor directives
Option A. They begin with a hash symbol
Option B. They are processed by a preprocessor
Option C. They form an integral part of the code
Option D. They have to end with a semi colon
Question: 28. What's wrong? while( (i < 10) && (i > 24))
Option A. the logical operator && cannot be used in a test condition
Option B. the while loop is an exit-condition loop
Option C. the test condition is always true
Option D. the test condition is always false
Question: 29. A continue statement causes execution to skip to
Option A. the return 0; statement
Option B. the first statement after the loop
Option C. the statement following the continue statement
Option D. the next iteration of the loop
Question: 30. What's wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);
Option A. the question mark should be an equal sign
Option B. the first semicolon should be a colon
Option C. there are too many variables in the statement
Option D. the conditional operator is only used with apstrings
Question: 31. What's wrong? for (int k = 2, k <=12, k++)
Option A. the increment should always be ++k
Option B. the variable must always be the letter i when using a for loop
Option C. there should be a semicolon at the end of the statement
Option D. the commas should be semicolons
Question: 32. Which of the following is not recommended in a header file?
Option A. Type definitions (typedefs)
Option B. Class definitions
Option C. Function definitions
Option D. Template definitions
Question: 33. Which of the STL containers store the elements contiguously (in adjecent memory locations)?
Option A. std::vector
Option B. std::list
Option C. std::map
Option D. std::set
Question: 34. Which of the following is not a standard exception built in C++.
Option A. std::bad_creat
Option B. std::bad_alloc
Option C. std::bad_cast
Option D. std::bad_typeid
Question: 35. What does STL stand for?
Option A. Simple Template Library
Option B. Standard Template Library
Option C. Static Type Library
Option D. Single Type-based Library
Question: 36. What is the difference between overloaded functions and overridden functions?
Option A. Overloading is a dynamic or run-time binding and Overriding is static or compile-time binding
Option B. Redefining a function in a friend class is called function overriding while Redefining a function in a derived class is called a overloaded fucntion.
Option C. Overloading is a static or compile-time binding and Overriding is dynamic or run-time binding
Option D. Redefining a function in a friend class is called function overloading while Redefining a function in a derived class is called as overridden fucnion.
Question: 37. Which one of the following is not a valid reserved keyword in C++
Option A. Explicit
Option B. Public
Option C. Implicit
Option D. Private
Question: 38. Each pass through a loop is called a/an
Option A. enumeration
Option B. iteration
Option C. culmination
Option D. pass through
Question: 39. No commas or blanks are allowed within an integer or a real constant.
Option A. True
Option B. False
Question: 40. void' is a datatype.
Option A. True
Option B. False
Question: 41. emp name' is a valid variable name.
Option A. True
Option B. False
Question: 42. unsigned' is a valid variable name.
Option A. True
Option B. False
Question: 43. Operation between an integer and float always yields a float result.
Option A. True
Option B. False
Question: 44. /* The C language.
/* is a procedural language .*/*/
The above statement is valid.
Option A. True
Option B. False
Question: 45. The default initial value of automatic storage class is 0.
Option A. True
Option B. False
Question: 46. = and = = have the same operation.
Option A. True
Option B. False
Question: 47. Character data types cannot be declared as unsigned.
Option A. True
Option B. False
Question: 48. && and & operators have the same meaning.
Option A. True
Option B. False
Question: 49. Right shifting an operand 1bit is equivalent to multiplying it by 2.
Option A. True
Option B. False
Question: 50. The same variable names of automatic type can be used in different functions without any conflict.
Option A. True
Option B. False
Question: 51. printf("%d", sizeof('2')); will print 2.
Option A. True
Option B. False
Question: 52. The expression "b = 3 ^ 2;" will evaluate b = 9.
Option A. True
Option B. False
Question: 53. The expression "int i = j = k = 0;" is invalid.
Option A. True
Option B. False
Question: 54. printf() is not a library function.
Option A. True
Option B. False
Question: 55. The expression (i + j)++ is illegal.
Option A. True
Option B. False
Question: 56. The expression 'int j = 6 + 3 % -9;' evaluates to -1.
Option A. True
Option B. False
Question: 57. p++ executes faster than p + 1.
Option A. True
Option B. False
Question: 58. static variable will not always have assigned value.
Option A. True
Option B. False
Question: 59. Variables declared as register storage type gets stored in CPU registers.
Option A. True
Option B. False
Question: 60. Single operations involving entire arrays are permitted in C.
Option A. True
Option B. False
Question: 61. The main() function can be called from any other function.
Option A. True
Option B. False
Question: 62. The main() function can call itself recursively.
Option A. True
Option B. False
Question: 63. The statement "for (i = 0, j = 2; j <= 10; j++)" is a valid statement in 'C'.
Option A. True
Option B. False
Question: 64. When a user defined function is defined in program, then it has to be called at least once from the main().
Option A. True
Option B. False
Question: 65. Left shift operator rotates the bits on the left and places them to the right.
Option A. True
Option B. False
Question: 66. A recursive function calls itself again and again.
Option A. True
Option B. False
Question: 67. Only one break can be used in one loop.
Option A. True
Option B. False
Question: 68. Every if statement can be converted into an equivalent switch statement.
Option A. True
Option B. False
Question: 69. Nested macros are allowed.
Option A. True
Option B. False
Question: 70. Expression 4**3 evaluates to 64.
Option A. True
Option B. False
Question: 71. All macro substitutions in a program are done before compilation of the program.
Option A. True
Option B. False
Question: 72. # define PI = 8;' is the correct declaration of macros.
Option A. True
Option B. False
Question: 73. An array declared as A[100][100] can hold a maximum of 100 elements.
Option A. True
Option B. False
Question: 74. The array 'char name[10] can consist of a maximum of 9 characters.
Option A. True
Option B. False
Question: 75. It is necessary to initialize the array at the time of declaration.
Option A. True
Option B. False
Question: 76. the value *(&i) is same as printing the value of address of i.
Option A. True
Option B. False
Question: 77. A pointer is an indication of the variable to be accessed next.
Option A. True
Option B. False
Question: 78. The contents of a file opened in 'r+' mode cannot be changed.
Option A. True
Option B. False
Question: 79. Union is used to hold different data at different time.
Option A. True
Option B. False
Question: 80. All elements of a structure are allocated contiguous memory locations.
Option A. True
Option B. False
Question: 81. enum helps to create user defined datatype.
Option A. True
Option B. False
Question: 82. The value of an enumerated datatype can be read using scanf() function.
Option A. True
Option B. False
Question: 83. Structures within structures cannot be created.
Option A. True
Option B. False
Question: 84. gets() and puts() are unformatted I/O functions.
Option A. True
Option B. False
Question: 85. The identifier argv[] is a pointer to an array of strings.
Option A. True
Option B. False
Question: 86. fprintf()function can be used to write into console.
Option A. True
Option B. False
Question: 87. fopen() function returns a pointer to the open file.
Option A. True
Option B. False
Question: 88. Which of the following language is predecessor to C Programming Language?
Option A. A
Option B. B
Option C. BCPL
Option D. C++
Question: 89. C programming language was developed by
Option A. Dennis Ritchie
Option B. Ken Thompson
Option C. Bill Gates
Option D. Peter Norton
Question: 90. C is a ___ language
Option A. High Level and Procedural
Option B. Low Level and OOPS
Option C. Middle Level and Procedural
Option D. Machine Level and OOPS
Question: 91. Which escape character can be used to beep from speaker in C?
Option A. \a
Option B. \b
Option C. \m
Option D.
Question: 92. Which of the following is invalid?
Option A. ''
Option B. " "
Option C. 'a'
Option D. abc'
Question: 93. A declaration float a, b; occupies ___ of memory
Option A. 1 byte
Option B. 4 bytes
Option C. 8 bytes
Option D. 16 bytes
Question: 94. The printf() function retunes which value when an error occurs?
Option A. Positive value
Option B. Zero
Option C. Negative value
Option D. None of these
Question: 95. Identify the wrong statement
Option A. putchar(65)
Option B. putchar('x')
Option C. putchar("x")
Option D. putchar('
')
Question: 96. Which header file is essential for using strcmp() function?
Option A. string.h
Option B. strings.h
Option C. text.h
Option D. strcmp.h
Question: 97. Which among the following is a unconditional control structure
Option A. do-while
Option B. if-else
Option C. goto
Option D. for
Question: 98. continue statement is used
Option A. to go to the next iteration in a loop
Option B. come out of a loop
Option C. exit and return to the main function
Option D. restarts iterations from beginning of loop
Question: 99. Which of the following is an example of compounded assignment statement?
Option A. a = 5
Option B. a += 5
Option C. a = b = c
Option D. a = b
Question: 100. In the expression - 'x + y + 3z =20'
Option A. x + y' is a keyword
Option B. 3 and 20 are constants
Option C. 3z is a constant
Option D. y is a variable and z is a constant
0 comments:
Post a Comment