main()
{
int i=400,j=300;
printf("%d..%d");
}

Answers were Sorted based on User's Feedback



main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / arun raj

Hi Surenda,

I think the answer is a garbage value.. i tried in gcc &
visual studio.. but i got garbage n both the case.. can u
tell which compile u compiled & got this output.

Regards
Arun Raj

Is This Answer Correct ?    15 Yes 2 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / laienjam rosan singh

In doing so, the values of i and j will be inserted into
the stack and at the time of displaying the values, LIFO
order is followed. For example in this question 400 is
inserted first and 300 second bcos i=400 is declared first.
But at the time of displaying on the screen using printf,
300 will come first as it follows LIFO. Again it is
important to note down that printf will display only the
two uppermost values in the stack in LIFO order as
default.If the code is modified as
main()
{
int i=400,j=300,k=500;
printf("%d..%d");
}
then the output is 500..300.It is because of the fact that
printf take only two uppermost values from the stack LIFO
order to be displayed on the screen.

Is This Answer Correct ?    10 Yes 2 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / ifti/amir/shah

300..400
i.e second no and the first...........

Is This Answer Correct ?    7 Yes 1 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / manju

answer is garbage value because in printf statement there
are no variables(i,j).

Is This Answer Correct ?    8 Yes 3 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / ravi

its machine Dependent

it displays garbage values in Linux

in some machines it will display 400 300
as they are on the top of stack

Is This Answer Correct ?    4 Yes 2 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / surenda pal singh chouhan

400..300

Explanation:
printf takes the values of the first two assignments of the
program. Any number of printf's may be given. All of them
take only the first two values. If more number of
assignments given in the program, then printf will take
garbage values.

Is This Answer Correct ?    8 Yes 7 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / preshit

output will b garbage value
because no variables are passed in last sentence.

Is This Answer Correct ?    5 Yes 4 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / sunil samal

300..400 because it will execute right to left .
when the printf () execute it will first execute from right to
left...
regards
sunilsamal@live.com

Is This Answer Correct ?    0 Yes 0 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / pritam

Answer:
400..300
Explanation:
printf takes the values of the first two assignments of the
program. Any number of printf's may be given. All of them
take only the first two values. If more number of
assignments given in the program,then printf will take
garbage values.

Is This Answer Correct ?    0 Yes 0 No

main() { int i=400,j=300; printf("%d..%d"); } ..

Answer / shanky

it will give error

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

What is the Lvalue and Rvalue?

2 Answers  


Why the below program throughs error during compilation? #include<stdio.h> #include<conio.h> enum { ZERO, ONE, TWO, }; main() { printf("%d",&TWO); getch(); }

2 Answers  


Write a c program using for loop in switch case?

1 Answers   Infosys,


There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.

0 Answers  


what is the meaning of java that is (J A V A) full form of JAVA

71 Answers   AKS University, Bhel, BNL, BPO, HCL, Peacecon,






The OS is a program that uses various data structures. Like all programs in execution, you can determine the performance and other behavior of the OS by inspecting its state - the values stored in its data structures. In this part of the assignment, we study some aspects of the organization and behavior of a Linux system by observing values of kernel data structures exposed through the /proc virtual file system. The /proc virtual file system: Linux uses the /proc file system to collect information from kernel data structures. The /proc implementation provided with Linux can read many different kernel data structures. If you cd to /proc on a Linux machine, you will see a number of files and directories at that location. Files in this directory subtree each corresponds to some kernel data structure. The subdirectories with numeric names contain virtual files with information about the process whose process ID is the same as the directory name. Files in /proc can be read like ordinary ASCII files. You can open each file and read it using library routines such as fgets() or fscanf(). The proc (5) manual page explains the virtual files and their content available through the /proc file system. Requirements in detail: In this part, you are asked to write a program to report the behavior of the Linux kernel. Your program should run in two different versions. The default version should print the following values on stdout: • Processor type • Kernel version • The amount of memory configured into this computer • Amount of time since the system was last booted A second version of the program should run continuously and print lists of the following dynamic values (each value in the lists is the average over a specified interval): • The percentage of time the processor(s) spend in user mode, system mode, and the percentage of time the processor(s) are idle • The amount and percentage of available (or free) memory • The rate (number of sectors per second) of disk read/write in the system • The rate (number per second) of context switches in the kernel • The rate (number per second) of process creations in the system If your program (compiled executable) is called proc_parse, running it without any parameter should print out information required for the first version. Running it with two parameters "proc_parse <read_rate> <printout_rate>" should print out information required for the second version. read_rate represents the time interval between two consecutive reads on the /proc file system. printout_rate indicates the time interval over which the average values should be calculated. Both read_rate and printout_rate are in seconds. For instance, proc_parse 2 60 should read kernel data structures once every two seconds. It should then print out averaged kernel statistics once a minute (average of 30 samples). The second version of your program doesn't need to terminate.

0 Answers   Cognos,


How are structure passing and returning implemented?

0 Answers  


Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc

4 Answers  


What is c++ used for today?

0 Answers  


define function

4 Answers   Assurgent, Sonata,


What is the size of a union variable?

0 Answers  


what is difference between userlevel threads and kernel level threads ?what are the trades offs between these two approaches ? what approach is most frequently used and why ?

1 Answers  


Categories