ProgrammingVery hardTCS NQT · Infosys
What is printed? Assume unsigned int is 32 bits.
What is printed? Assume unsigned int is 32 bits.
#include <stdio.h>
int main(void) {
printf("%u", 1 ? -1 : 0u);
}- A. 4294967295
- B. 2
- C. 0
- D. 1
Correct answer: A. 4294967295
The second and third operands have the usual arithmetic conversions applied, so -1 becomes the unsigned value 4294967295.
More C Programming questions
- How many partitions of 6 into distinct parts are there? The recursion below counts them. What is printed? c #include <stdio.h> int dp(int…
- How many ways are there to tile a 1 by 4 strip with 1 by 1 and 1 by 2 tiles? The recursion computes it. What is printed? c #include…
- What is printed? The program computes the parity of the set bits of 0b1101. c #include <stdio.h> int parity(unsigned x) { return x == 0 ?…
- What is the position of the lowest set bit of 0x0300 (counting bit 0 as position 0)? Compute with this program. c #include <stdio.h> int…
- What is printed? The program inverts the Gray code 6 by XOR-folding its bits. c #include <stdio.h> int main(void) { unsigned g = 6, n = 0…
- What is printed? c #include <stdio.h> int main(void) { unsigned char c = 200; if (c 2 > 300) puts("big"); else puts("small"); }