Professional Documents
Culture Documents
Placement Session - 1
Placement Session - 1
T2 – TRAINING – BATCH 1
C SYNTAX
C=A+B
Main()
{
1 declaration
2.input
3.process
4.output a 5
}
b 10
1. declaration 15
c
int a,b,c;
C=A+B
2. Input
scanf()
//10
3.process
addition
c=a+b;
4.output
printf()
Syntax
}
DATA TYPES
int - %d
long int %ld
Float %f
Double %lf
char a, v %c
void
PREDICT THE OUTPUT
#include<stdio.h>
int X=40;
int main()
{
int X=20;
printf("%d\n", X);
return 0;
}
PREDICT THE OUTPUT
#include<stdio.h>
int main()
{
int i;
i = 20;
printf("%d\n", sizeof(i));
return 0;
}
PREDICT THE OUTPUT
#include<stdio.h>
int main()
{
extern int a;
printf("%d\n", a);
return 0;
}
int a=20;
OPERATORS IN C
A B A&B A|B
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 1
X=X+C +=
4.3/2=2
4.3%2=0.3
PREDICT THE OUTPUT
What is the output of this C code?
void main()
{
int k = 8;
int x = 0 == 1 && k++;
printf("%d%d\n", x, k);
}
PICK OUT THE RIGHT OPTION
The precedence of arithmetic operators is (from highest
to lowest)?
A. %, *, /, +, -
B. %, +, /, *, -
C. +, -, %, *, /
D. %, +, -, *, /
PREDICT THE OUTPUT
#include <stdio.h>
int main()
{
//Assume sizeof character is 1 byte and sizeof integer is
4 bytes
printf("%d", sizeof(printf(“Welcome")));
return 0;
}
PREDICT THE OUTPUT
#include <stdio.h>
int main()
{
int a = 10, b = 20, c = 30;
if (c > b > a)
printf("TRUE");
else
printf("FALSE");
return 0;
}
PREDICT THE OUTPUT
void main()
{
int x = 0;
if (x = 0)
printf("Its zero\n");
else
printf("Its not zero\n");
}
PREDICT THE OUTPUT
int main()
{
int x = 2, y = 1;
x *= x + y;
printf("%d\n", x);
return 0;
}
PREDICT THE OUTPUT
int main()
{
int x = 2, y = 2;
x /= x / y;
printf("%d\n", x);
return 0;
}
PREDICT THE OUTPUT
int main()
{
int x = 1, y = 0;
x &&= y;
printf("%d\n", x);
}
PREDICT THE OUTPUT
int main()
{
int c = 2 ^ 3;
printf("%d\n", c);
}
WHICH OF THE FOLLOWING IS NOT A
LOGICAL OPERATOR?
(A) &&
(B) !
(C) ||
(D) |
PREDICT THE OUTPUT
#include<stdio.h>
int main()
{
char a = 5, b = 9;
printf("a<<1 = %d\n", a<<1);
printf("b<<1 = %d\n", b<<1);
return 0;
}