0% found this document useful (0 votes)
17 views2 pages

C Appti Day 3

The document contains multiple C programming code snippets demonstrating various concepts such as variable assignments, switch-case statements, bitwise operations, and loop control. It highlights common pitfalls like using assignment instead of comparison in conditions and the implications of modifying variables within expressions. Additionally, it poses questions about expected outputs in different system architectures.

Uploaded by

physicstutormcq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

C Appti Day 3

The document contains multiple C programming code snippets demonstrating various concepts such as variable assignments, switch-case statements, bitwise operations, and loop control. It highlights common pitfalls like using assignment instead of comparison in conditions and the implications of modifying variables within expressions. Additionally, it poses questions about expected outputs in different system architectures.

Uploaded by

physicstutormcq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

#include <stdio.h>
int main() {
int x = 5, y = 10;
if (x = y)
printf("True");
else
printf("False");
return 0;
}
------------------------------
2.
#include <stdio.h>
void main(){
int a=2;
switch(a){
case 1: printf("A");
break;
case 2:printf("B");
continue;
case 3:printf("C");
break;
case 4:
default:printf("E");
}
}
-----------------------------------
3.
Left shifting an unsigned int or char by 1 is always equivalent to
_______________it by 2.
subtracting
b.adding
c.multiplying
d.dividing
---------------------------------------------
4.
#include <stdio.h>
int main(){
printf("%d,%d\n,sizeof(NULL),sizeof(""));
return 0;
}

what is 32 bit system output?


what is 64 bit system output?
-------------------------------
5.
#include <stdio.h>
void main(){
int a=1;
while(a<=10){
printf("%d ",a);
if(a>3){
break;}
a++;

printf("%d ",a+10);
}}
----------------------------------------
6.
#include <stdio.h>
int main() {
int x = 10;
printf("%d", ++x + x++);
return 0;
}
--------------------------
7.

#include <stdio.h>
int main() {
int a = 5;
printf("%d", a == a++);
return 0;
}

--------------------------------
8.
#include <stdio.h>
int main() {
int i = 1;
while (i = i + 1) {
if (i > 5) break;
printf("%d ", i);
}
return 0;
}

You might also like