- Home
- Placement
- Programming
- Variables & Constants
- Array
- Data Types
- Functions
- Loop & Control Statements
- Operators & Expressions
- Pointer
- Preprocessor
- Storage Classes
- Structure & Union
- Variables & Constants
- Classes and Objects
- Consructors and Destructors
- Exception handling
- File Handling
- Function Overloading
- Inheritance
- Operator Overloading
- Polymorphism
- Templates
C Language
C++ language
JAVA
-
-
( 1 ) What is the output of this C code?
int main()
{
int var = 010;
printf("%d", var);
} - 1) 2
- 2) 8
- 3) 9
- 4) 10
-
Show Answer Report Discussion in forumAnswer : 2) 8
Solution : 010 is octal representation of 8.
discussion
Answer : 2) 8
-
-
-
( 2 ) Choose the correct statements
- 1) during external variable definition, storage is set aside by the compiler **
- 2) during external variable declaration, no storage is set aside by the compiler
- 3) the use of external variables may make debugging difficult
- 4) All of the above
-
Show Answer Report Discussion in forumAnswer : 4) All of the above
Solution :
discussion
Answer : 4) All of the above
-
-
-
( 3 ) In case of ordinary int variables
- 1) leftmost bit is reserved for sign **
- 2) rightmost bit is reserved for sign
- 3) no bit is reserved for sign
- 4) None of these
-
Show Answer Report Discussion in forumAnswer : 1) leftmost bit is reserved for sign **
Solution :
discussion
Answer : 1) leftmost bit is reserved for sign **
-
-
-
( 4 ) Which is valid C expression?
- 1) int my_num = 100,000;
- 2) int my_num = 100000;
- 3) int my num = 1000;
- 4) int $my_num = 10000;
-
Show Answer Report Discussion in forumAnswer : 2) int my_num = 100000;
Solution : space, comma and $ cannot be used in a variable name.
discussion
Answer : 2) int my_num = 100000;
-
-
-
( 5 ) Which of the following is not a valid variable name declaration?
- 1) int __a3;
- 2) int __3a;
- 3) int __A3;
- 4) None of these
-
Show Answer Report Discussion in forumAnswer : 4) None of these
Solution :
discussion
Answer : 4) None of these
-
-
-
( 6 ) The variables which can be accessed by all modules in a program, are called
- 1) local variables **
- 2) internal variables
- 3) external variable
- 4) global variables
-
Show Answer Report Discussion in forumAnswer : 4) global variables
Solution :
discussion
Answer : 4) global variables
-
-
-
( 7 ) Comment on the output of this C code?
#include
void main()
{
int const k = 5;
k++;
printf("k is %d", k);
} - 1) k is 6
- 2) Error due to const succeeding int
- 3) Error, because a constant variable can be changed only twice
- 4) Error, because a constant variable cannot be changed
-
Show Answer Report Discussion in forumAnswer : 4) Error, because a constant variable cannot be changed
Solution :
discussion
Answer : 4) Error, because a constant variable cannot be changed
-
-
-
( 8 ) What will be output of the following c program?
#include
int main()
{
int max-val=100;
int min-val=10;
int avg-val;
avg-val = max-val + min-val / 2;
printf("%d",avg-val);
return 0;
} - 1) 55
- 2) 105
- 3) 60
- 4) Compilation error
-
Show Answer Report Discussion in forumAnswer : 4) Compilation error
Solution : We cannot use special character - in the variable name.
discussion
Answer : 4) Compilation error
-
-
-
( 9 ) Which of the following is not a valid variable name declaration?
- 1) float PI = 3.14;
- 2) double PI = 3.14;
- 3) int PI = 3.14;
- 4) #define PI 3.14
-
Show Answer Report Discussion in forumAnswer : 4) #define PI 3.14
Solution : #define PI 3.14 is a macro preprocessor, it is a textual substitution.
discussion
Answer : 4) #define PI 3.14
-
-
-
( 10 ) Which is an incorrect variable name?
- 1) Id_No
- 2) ID_NO
- 3) IdNo
- 4) Id No
-
Show Answer Report Discussion in forumAnswer : 4) Id No
Solution : Because there is a blank space in the variable name, which is not permitted in C.
discussion
Answer : 4) Id No
-