C
Programming and Technical
Programming
Program
#include
main(){
int a;
a=1,2;
printf("%d",a);
}
Options
1) 1
2) 2
3) Syntax error
4) none
Read Solution (Total 22)
-
- the above code has error ..
the code is written as...
main()
{
int a;
a=1,2;
printf("%d",a);
}
and the o/p----> 1 - 10 years agoHelpfull: Yes(10) No(4)
- new value of a=2
as it is overridided by its previous value. - 10 years agoHelpfull: Yes(7) No(3)
- Ans. 1
it gives output 1 on turbpoo c - 10 years agoHelpfull: Yes(2) No(0)
- option 3
two numbers can not be given to a single variable - 9 years agoHelpfull: Yes(2) No(0)
- in stack firstly 1 and then 2 will contain. so when we retrieve the value of a so we will get 2.
- 10 years agoHelpfull: Yes(1) No(4)
- give error at 3 rd line
- 10 years agoHelpfull: Yes(1) No(3)
- a=1
because here comma is used as separator so 1 will store into a first
suppose if it is given as
int a;
a=1,2,3;
then it will give error
- 10 years agoHelpfull: Yes(1) No(3)
- it shows an error
- 10 years agoHelpfull: Yes(1) No(1)
- Its depend upon compiler.....
- 10 years agoHelpfull: Yes(0) No(1)
- 2
the values of a is stored by stack method... a=2,1;
- 10 years agoHelpfull: Yes(0) No(0)
- given code has error
that error occured in 3rd line;
int a;
a=1,2,3,4,5,6,7,8,65,45,34,23,54............................;
output is :1 - 10 years agoHelpfull: Yes(0) No(1)
- 1
because "=" precedence is higher then "," - 9 years agoHelpfull: Yes(0) No(0)
- the answer is 1
- 9 years agoHelpfull: Yes(0) No(0)
- none...because int takes one value at a time .......
- 9 years agoHelpfull: Yes(0) No(0)
- it will give an error as we are not including any header file.after giving the header file the answer would be 1.
- 9 years agoHelpfull: Yes(0) No(0)
- = operator always assigs from right to left ie initially a=2 then it will be replaced by a=1 and hence output will be 1
- 9 years agoHelpfull: Yes(0) No(0)
- a=1,2;
it reads it from left to right and the firts value which it got it takes it and ignore the value after comma - 9 years agoHelpfull: Yes(0) No(0)
- option 1 is correct
coz a will return 1 as an output but it will print this 1 three times......like this..111 - 9 years agoHelpfull: Yes(0) No(0)
- The above program will produces o/p as 1. if int a=1,2; then it will CE or if int a=(1,2) then o/p=2.
- 9 years agoHelpfull: Yes(0) No(0)
- plz send me HITACHI CONSULTING LTD question paper.
my email id - amitranjankumar92@gmail.com
- 9 years agoHelpfull: Yes(0) No(0)
- assigning to values Code has no effect so answer is none
- 9 years agoHelpfull: Yes(0) No(0)
- option 1
- 9 years agoHelpfull: Yes(0) No(0)
C Other Question