Char ch = 21;
ch = ch<<3;
printf("%d",ch); What is the output ( ) //Ignore typing error
ch = ch<<3;
printf("%d",ch); What is the output ( ) //Ignore typing error
Anonymous Quiz
27%
34
24%
-88
14%
-68
35%
18
👍11👎2❤1🥰1👏1
What is the output of this program?
#include <stdio.h>
int main() {
printf("%d", printf("ABCD"));
return 0;
}
#include <stdio.h>
int main() {
printf("%d", printf("ABCD"));
return 0;
}
👍13🤔10
👍8❤1
Untold Coding
Char ch = 21;
ch = ch<<3;
printf("%d",ch); What is the output ( ) //Ignore typing error
ch = ch<<3;
printf("%d",ch); What is the output ( ) //Ignore typing error
In this question we use formal a×2^k and
-(2^n -k) here k is the number and n is the no. of bit
Therefore
We have n = 8 , (char size)
K = 21
- ( 2⁸ -168) = - (256-168)
= -88
-(2^n -k) here k is the number and n is the no. of bit
Therefore
We have n = 8 , (char size)
K = 21
- ( 2⁸ -168) = - (256-168)
= -88
👍11
👍12🔥1
👍14🥰2❤1
Untold Coding
#include <stdio.h> int main() { int i = -1; for (++i; i++; i++) printf("Untoldcoding"); return 0; }
Think and give answer ... In quiz
Untold Coding
#include <stdio.h> int main() { int i = -1; for (++i; i++; i++) printf("Untoldcoding"); return 0; }
Explanation
1. Initialization : The loop starts with
++i
, which increments i
from -1 to 0.2. Condition : The condition
i++
is checked next. Since i++
returns the value of i
before incrementing, the loop checks if 0 is true, which it is not (0 is considered false in C).3. Increment: If the condition were true, the loop would proceed to increment
i
with i++
again, but this part doesn't get executed in this case because the condition i++
evaluates to false on the first check.Due to the condition
i++
being false when i
is 0, the loop doesn't execute even once. Therefore, "Untoldcoding" is never printed.Still have any doubt ? Drop a comment 👇
👍13
Consider the following C program:
#include <stdio.h>
int main( )
{
int i, j, k = 0;
j=2*3/4+2.0/5+8/5;
k -= --j;
for (i=0; i<5; i++)
{
switch(i+k)
{
case 1:
case 2: printf("\n%d", i+k);
case 3: printf("\n%d", i+k)
default: printf("\n%d", i+k);
}
}
return 0;
}
#include <stdio.h>
int main( )
{
int i, j, k = 0;
j=2*3/4+2.0/5+8/5;
k -= --j;
for (i=0; i<5; i++)
{
switch(i+k)
{
case 1:
case 2: printf("\n%d", i+k);
case 3: printf("\n%d", i+k)
default: printf("\n%d", i+k);
}
}
return 0;
}
👍12
👍10❤1👏1
Untold Coding
Consider the following C program: #include <stdio.h> int main( ) { int i, j, k = 0; j=2*3/4+2.0/5+8/5; k -= --j; for (i=0; i<5; i++) { switch(i+k) { case 1: case 2: printf("\n%d", i+k); …
Explanation
Total printf Calls
Summing up all the outputs from each iteration:
Iteration 1: 1 time
Iteration 2: 1 time
Iteration 3: 3 times
Iteration 4: 3 times
Iteration 5: 2 times
Total number of printf calls: 1 + 1 + 3 + 3 + 2 = 10
Still have any confusion, drop a comment 👇
👍8❤1
#include <stdio.h>
int main()
{
int i;
for(i=1; i<=10; i++){
if(i>5){
break;
}
}
printf("%d",i);
return 0;
}
int main()
{
int i;
for(i=1; i<=10; i++){
if(i>5){
break;
}
}
printf("%d",i);
return 0;
}
👍14❤1
👍15
Consider the C Programming
#include<stdio.h>
void print (int n) {
if (n <= 0) return;
print(n--);
printf ("%d", n);
}
int main() {
print(5);
return 0;
}
#include<stdio.h>
void print (int n) {
if (n <= 0) return;
print(n--);
printf ("%d", n);
}
int main() {
print(5);
return 0;
}
👍11
Output will be?
Anonymous Quiz
41%
5, 4, 3, 2 , 1
19%
1, 2, 3, 4, 5
24%
Abnormal Terminate
16%
Error
👍10🔥1👏1😁1
Consider the following sample of numbers: 9, 18, 11, 14, 15, 17, 10, 69, 11, 13 The median of the sample is
(a) 14
(b) 13.5
(c) 12
(d) 11
(a) 14
(b) 13.5
(c) 12
(d) 11
👍10