SlideShare a Scribd company logo
1 of 41
Operators in ‘C’
In C language, operators are categorized in following six categories :
 Arithmetic: Perform basic mathematical operations over one or more than one operands.
 Relational and Logical operator: Relational operators are used to compare two
expressions and return the value as 0 and 1. Logical operator combines two or more
operands.
 Bitwise: Bitwise operator operates at bit level..
 Assignment Operator: Assigns value.
Technical Training (C Basics)
Operators in ‘C’
Simplest meaning of operator is which works on operand.
 Arithmetic:
 Perform basic mathematical operations on operands.
1-Unary Operator (one operand)
2-Binary Operator (two operand)
Unary Operator (one operand)
Increment- The ++ operator is used to increment the value of integer.
a++ post increment ++a pre increment
Decrement- The -- operator is used to decrement the value of integer.
a-- post decrement --a pre decrement
Technical Training (C Basics)
Operator Definition Example Unary or Binary
+ adds two operands a+b binary
- Subtracts second operands from first. a-b binary
* multiply two operands a*b binary
/ Divides numerator by denominator. a/b binary
% Gives remainder after an integer division. a%b binary
++ Increase an integer value by one. ++a , a++ unary
-- Decrease an integer value by one. --a , a-- unary
Technical Training (C Basics)
What would be the output of the above code ? Choose
the correct option.
A. 1.0 B. 5.0
C. 2.0 D. Error
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
float a=5.0,b=2.0,c;
c=a % b;
printf("%f",c);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 1.0 B. 5.0
C. 2.0 D. Error
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
float a=5.0,b=2.0,c;
c=a % b;
printf("%f",c);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 22 B. 32
C. 24 D. 30
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
int a=5,b=2,c;
c=a++ + ++b + b++ + ++a + a++ + ++b;
printf("%d",c);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 22 B. 32
C. 24 D. 30
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
int a=5,b=2,c;
c=a++ + ++b + b++ + ++a + a++ + ++b;
printf("%d",c);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 22 B. 12
C. 24 D. Compiler
dependent
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
int a=5,b=3,c;
c=a-- + --a + b-- + --b + --b + --a;
printf("%d",c);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 22 B. 12
C. 24 D. Compiler
dependent
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
int a=5,b=3,c;
c=a-- + --a + b-- + --b + --b + --a;
printf("%d",c);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 7 7 6 B. 5 7 8
C. 5 6 7 D. Compiler
dependent
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
int a=5;
printf("%d%d%d",a++,++a,++a);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 7 7 6 B. 5 7 8
C. 5 6 7 D. Compiler
dependent
Technical Training (C Basics)
#include <stdio.h>
int main(void)
{
int a=5;
printf("%d%d%d",a++,++a,++a);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 4 B. error
C. 5 D. Compiler
dependent
Technical Training (C Basics)
#include <stdio.h>
int main()
{
int i = 3;
printf("%d", (++i)++);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 4 B. error
C. 5 D. Compiler
dependent
Technical Training (C Basics)
#include <stdio.h>
int main()
{
int a = 4;
printf("%d", (++a)++);
return 0;
}
 Bitwise Operator: In C bitwise operator works at bit level.
Operator Definition
& Bitwise And
| Bitwise Or
^ Bitwise XOR
~ Bitwise NOT
>> Right Shift Operator
<< Left Shift Operator
Technical Training (C Basics)
 Bitwise Operator:
points to remember-
1.Left and right shift operators should not be used for negative numbers.
2.if the number is shifted more than the size of integer the behavior is undefined.
3.The bitwise operator should not be used in place of logical operators.
Technical Training (C Basics)
What would be the output of the above code ? Choose
the correct option.
A. 4 B. error
C. 5 D. Compiler
dependent
Technical Training (C Basics)
#include <stdio.h>
int main()
{
int i = 3;
printf("%d", (++i)++);
return 0;
}
Operators in ‘C’
In C language, operators are categorized in following six categories :
 Logical Operator: Perform basic mathematical operations over one or more than one
operands.
Operator Definition
&& Logical And
|| Logical Or
Technical Training (C Basics)
Operators in ‘C’
In C language, operators are categorized in following six categories :
 Assignment Operator:
 It is a binary Operator
 Evaluates the operator on Right side and assigns it to on Left side.
 Example
Technical Training (C Basics)
Operators in ‘C’
In C language, operators are categorized in following six categories :
Operators Type Associativity
() [] -> . Left to right
! ~ ++ -- + - * & (type) sizeof Unary Right to left
* / % Binary Left to right
+ - Binary Left to right
<< >> Binary Left to right
< <= > >= Binary Left to right
== != Binary Left to right
& Binary Left to right
^ Binary Left to right
| Binary Left to right
&& Binary Left to right
|| Binary Left to right
?: Binary Right to left
= += -= *= /= %= &= |= ^= >>= <== Binary Right to left
, Binary Left to right
Technical Training (C Basics)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
int a = 2;
int a;
int main(void) {
printf("%d", a);
int a;
for(int i = 0 ; i < 3 ; i++ )
{
printf("%d", a);
a++;
}
printf("%d", a);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 2 0 1 2 3 B. 2 2 2 2 3
C. 2 1 1 2 2 D. Compiler error
Technical Training (C Basics) TCS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
int a = 2;
int a;
int main(void) {
printf("%d", a);
int a;
for(int i = 0 ; i < 3 ; i++ )
{
printf("%d", a);
a++;
}
printf("%d", a);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 2 0 1 2 3 B. 2 2 2 2 3
C. 2 1 1 2 2 D. Compiler error
Technical Training (C Basics) TCS
1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>
int a = 12;
int main(void) {
for(int j = 0; j <= 1; j++)
{
int a = 4;
a++;
}
printf("%d" , a);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 4 B. 12
C. 5 D. Compiler error
Technical Training (C Basics) Capegemini
1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>
int a = 12;
int main(void) {
for(int j = 0; j <= 1; j++)
{
int a = 4;
a++;
}
printf("%d" , a);
return 0;
}
What would be the output of the above code ? Choose
the correct option.
A. 4 B. 12
C. 5 D. Compiler error
Technical Training (C Basics) Capegemini
1
2
3
4
5
6
7
8
9
10
What would be the output of the above code ? Choose
the correct option.
A. 4 B. 5
C. 6 D. Error
#include <stdio.h>
int main(void) {
for(int i = 0; i < 2; i++)
{
static int a = 4;
a++;
}
printf("%d", a);
return 0;
}
Technical Training (C Basics) TCS
1
2
3
4
5
6
7
8
9
10
What would be the output of the above code ? Choose
the correct option.
A. 4 B. 5
C. 6 D. Error
#include <stdio.h>
int main(void) {
for(int i = 0; i < 2; i++)
{
static int a = 4;
a++;
}
printf("%d", a);
return 0;
}
Technical Training (C Basics) TCS
1
2
3
4
5
6
7
8
9
10
11
12
13
What would be the output of the above code ? Choose
the correct option.
A. 0 1 B. 2 3
C. 3 4 D. Error
#include <stdio.h>
int a;
int main(void) {
{
a = 2;
}
for(int i = 0; i < 2; i++)
{
a++ ;
printf("%d " , a);
}
return 0 ;
}
Technical Training (C Basics) Capegemini
1
2
3
4
5
6
7
8
9
10
11
12
13
What would be the output of the above code ? Choose
the correct option.
A. 0 1 B. 2 3
C. 3 4 D. Error
#include <stdio.h>
int a;
int main(void) {
{
a = 2;
}
for(int i = 0; i < 2; i++)
{
a++ ;
printf("%d " , a);
}
return 0 ;
}
Technical Training (C Basics) Capegemini
1
2
3
4
5
6
7
8
9
10
11
12
What would be the output of the above code ? Choose
the correct option.
A. 1 10 0 B. 1 10 1
C. 1 10 10 D. Error
#include <stdio.h>
int main(void) {
int x = 1 ;
printf("%d", x ); {
int x = 10;
printf("%d", x ); {
x;
printf("%d", x );
}
}
return 0;
}
Technical Training (C Basics) Infosys
1
2
3
4
5
6
7
8
9
10
11
12
What would be the output of the above code ? Choose
the correct option.
A. 1 10 0 B. 1 10 1
C. 1 10 10 D. Error
#include <stdio.h>
int main(void) {
int x = 1 ;
printf("%d", x ); {
int x = 10;
printf("%d", x ); {
x;
printf("%d", x );
}
}
return 0;
}
Technical Training (C Basics) Infosys
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
What would be the output of the above code ? Choose
the correct option.
A. 20 20 B. 30 20
C. 10 20 D. 20 30
# include<stdio.h>
int a = 10;
int main(void) {
{
a = 30;
{
{
a = 20;
printf("%d", a);
}
}
printf("%d", a);
}
return 0;
}
Technical Training (C Basics) Accenture
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
What would be the output of the above code ? Choose
the correct option.
A. 20 20 B. 30 20
C. 10 20 D. 20 30
# include<stdio.h>
int a = 10;
int main(void) {
{
a = 30;
{
{
a = 20;
printf("%d", a);
}
}
printf("%d", a);
}
return 0;
}
Technical Training (C Basics) Accenture
1
2
3
4
5
6
What would be the output of the above code ? Choose
the correct option.
A. 28 B. 25
C. 29 D. 30
#include<stdio.h>
int main(void) {
int a = 7;
int s = a++ + ++a + a-- + a % 2;
printf("%d", s);
}
Technical Training (C Basics) TCS
1
2
3
4
5
6
What would be the output of the above code ? Choose
the correct option.
A. 28 B. 25
C. 29 D. 30
#include<stdio.h>
int main(void) {
int a = 7;
int s = a++ + ++a + a-- + a % 2;
printf("%d", s);
}
Technical Training (C Basics) TCS
1
2
3
4
5
6
7
8
9
What would be the output of the above code ? Choose
the correct option.
A. 2 1 1 B. 3 2 1
C. 3 1 1 D. 2 2 1
#include<stdio.h>
int main(void) {
int i = 1, j = 2, k, l = 1;
{
k = i++ + ++i + j || l++;
printf("%d %d %d", i, l, k);
}
return 0;
}
Technical Training (C Basics) Capegemini
1
2
3
4
5
6
7
8
9
What would be the output of the above code ? Choose
the correct option.
A. 2 1 1 B. 3 2 1
C. 3 1 1 D. 2 2 1
#include<stdio.h>
int main(void) {
int i = 1, j = 2, k, l = 1;
{
k = i++ + ++i + j || l++;
printf("%d %d %d", i, l, k);
}
return 0;
}
Technical Training (C Basics) Capegemini
1
2
3
4
5
6
What would be the output of the above code ? Choose
the correct option.
A. 3 B. 4
C. 2 D. 1
#include <stdio.h>
int main(void) {
int a = 5;
int s = a-- || a-- && 4;
printf("%d", s);
}
Technical Training (C Basics) Infosys
1
2
3
4
5
6
What would be the output of the above code ? Choose
the correct option.
A. 3 B. 4
C. 2 D. 1
#include <stdio.h>
int main(void) {
int a = 5;
int s = a-- || a-- && 4;
printf("%d", s);
}
Technical Training (C Basics) Infosys
1
2
3
4
5
6
7
8
9
What would be the output of the above code ? Choose
the correct option.
A. 1 0 2 B. 1 1 3
C. 2 0 3 D. 2 1 2
#include<stdio.h>
int main(void) {
int i = 0, j = 2, k, l = 0;
{
k = (i++ && l++ ) || j++ + i++;
printf("%d %d %d", i, l, j);
}
return 0;
}
Technical Training (C Basics) Accenture
1
2
3
4
5
6
7
8
9
What would be the output of the above code ? Choose
the correct option.
A. 1 0 2 B. 1 1 3
C. 2 0 3 D. 2 1 2
#include<stdio.h>
int main(void) {
int i = 0, j = 2, k, l = 0;
{
k = (i++ && l++ ) || j++ + i++;
printf("%d %d %d", i, l, j);
}
return 0;
}
Technical Training (C Basics) Accenture
1
2
3
4
5
6
7
8
9
10
What would be the output of the above code ? Choose
the correct option.
A. 4 5 B. 4 4
C. 5 4 D. 5 5
#include<stdio.h>
int main(void) {
int i = 10, j = 10;
int k = 4;
{
printf("%d", sizeof(k /= i+j));
printf("%d", k) ;
}
return 0;
}
Technical Training (C Basics) Infosys
1
2
3
4
5
6
7
8
9
10
What would be the output of the above code ? Choose
the correct option.
A. 4 5 B. 4 4
C. 5 4 D. 5 5
#include<stdio.h>
int main(void) {
int i = 10, j = 10;
int k = 4;
{
printf("%d", sizeof(k /= i+j));
printf("%d", k) ;
}
return 0;
}
Technical Training (C Basics) Infosys

More Related Content

Similar to operators.ppt

Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans incnayakq
 
C++ lab assignment
C++ lab assignmentC++ lab assignment
C++ lab assignmentSaket Pathak
 
cuptopointer-180804092048-190306091149 (2).pdf
cuptopointer-180804092048-190306091149 (2).pdfcuptopointer-180804092048-190306091149 (2).pdf
cuptopointer-180804092048-190306091149 (2).pdfYashwanthCse
 
Technical aptitude Test 1 CSE
Technical aptitude Test 1 CSETechnical aptitude Test 1 CSE
Technical aptitude Test 1 CSESujata Regoti
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILEDipta Saha
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentalsZaibi Gondal
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1Zaibi Gondal
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomeshpraveensomesh
 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsAmrinder Sidhu
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cppNilesh Dalvi
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2Don Dooley
 

Similar to operators.ppt (20)

Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
C++ lab assignment
C++ lab assignmentC++ lab assignment
C++ lab assignment
 
cuptopointer-180804092048-190306091149 (2).pdf
cuptopointer-180804092048-190306091149 (2).pdfcuptopointer-180804092048-190306091149 (2).pdf
cuptopointer-180804092048-190306091149 (2).pdf
 
Technical aptitude Test 1 CSE
Technical aptitude Test 1 CSETechnical aptitude Test 1 CSE
Technical aptitude Test 1 CSE
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
UNIT 2 LOOP CONTROL.pptx
UNIT 2 LOOP CONTROL.pptxUNIT 2 LOOP CONTROL.pptx
UNIT 2 LOOP CONTROL.pptx
 
C exam
C examC exam
C exam
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
Technical quiz 5#.pptx
Technical quiz 5#.pptxTechnical quiz 5#.pptx
Technical quiz 5#.pptx
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
Unit i intro-operators
Unit   i intro-operatorsUnit   i intro-operators
Unit i intro-operators
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
 
C language
C languageC language
C language
 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operators
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
 
Java Quiz
Java QuizJava Quiz
Java Quiz
 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2
 
Oops Quiz
Oops QuizOops Quiz
Oops Quiz
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 

operators.ppt

  • 1. Operators in ‘C’ In C language, operators are categorized in following six categories :  Arithmetic: Perform basic mathematical operations over one or more than one operands.  Relational and Logical operator: Relational operators are used to compare two expressions and return the value as 0 and 1. Logical operator combines two or more operands.  Bitwise: Bitwise operator operates at bit level..  Assignment Operator: Assigns value. Technical Training (C Basics)
  • 2. Operators in ‘C’ Simplest meaning of operator is which works on operand.  Arithmetic:  Perform basic mathematical operations on operands. 1-Unary Operator (one operand) 2-Binary Operator (two operand) Unary Operator (one operand) Increment- The ++ operator is used to increment the value of integer. a++ post increment ++a pre increment Decrement- The -- operator is used to decrement the value of integer. a-- post decrement --a pre decrement Technical Training (C Basics)
  • 3. Operator Definition Example Unary or Binary + adds two operands a+b binary - Subtracts second operands from first. a-b binary * multiply two operands a*b binary / Divides numerator by denominator. a/b binary % Gives remainder after an integer division. a%b binary ++ Increase an integer value by one. ++a , a++ unary -- Decrease an integer value by one. --a , a-- unary Technical Training (C Basics)
  • 4. What would be the output of the above code ? Choose the correct option. A. 1.0 B. 5.0 C. 2.0 D. Error Technical Training (C Basics) #include <stdio.h> int main(void) { float a=5.0,b=2.0,c; c=a % b; printf("%f",c); return 0; }
  • 5. What would be the output of the above code ? Choose the correct option. A. 1.0 B. 5.0 C. 2.0 D. Error Technical Training (C Basics) #include <stdio.h> int main(void) { float a=5.0,b=2.0,c; c=a % b; printf("%f",c); return 0; }
  • 6. What would be the output of the above code ? Choose the correct option. A. 22 B. 32 C. 24 D. 30 Technical Training (C Basics) #include <stdio.h> int main(void) { int a=5,b=2,c; c=a++ + ++b + b++ + ++a + a++ + ++b; printf("%d",c); return 0; }
  • 7. What would be the output of the above code ? Choose the correct option. A. 22 B. 32 C. 24 D. 30 Technical Training (C Basics) #include <stdio.h> int main(void) { int a=5,b=2,c; c=a++ + ++b + b++ + ++a + a++ + ++b; printf("%d",c); return 0; }
  • 8. What would be the output of the above code ? Choose the correct option. A. 22 B. 12 C. 24 D. Compiler dependent Technical Training (C Basics) #include <stdio.h> int main(void) { int a=5,b=3,c; c=a-- + --a + b-- + --b + --b + --a; printf("%d",c); return 0; }
  • 9. What would be the output of the above code ? Choose the correct option. A. 22 B. 12 C. 24 D. Compiler dependent Technical Training (C Basics) #include <stdio.h> int main(void) { int a=5,b=3,c; c=a-- + --a + b-- + --b + --b + --a; printf("%d",c); return 0; }
  • 10. What would be the output of the above code ? Choose the correct option. A. 7 7 6 B. 5 7 8 C. 5 6 7 D. Compiler dependent Technical Training (C Basics) #include <stdio.h> int main(void) { int a=5; printf("%d%d%d",a++,++a,++a); return 0; }
  • 11. What would be the output of the above code ? Choose the correct option. A. 7 7 6 B. 5 7 8 C. 5 6 7 D. Compiler dependent Technical Training (C Basics) #include <stdio.h> int main(void) { int a=5; printf("%d%d%d",a++,++a,++a); return 0; }
  • 12. What would be the output of the above code ? Choose the correct option. A. 4 B. error C. 5 D. Compiler dependent Technical Training (C Basics) #include <stdio.h> int main() { int i = 3; printf("%d", (++i)++); return 0; }
  • 13. What would be the output of the above code ? Choose the correct option. A. 4 B. error C. 5 D. Compiler dependent Technical Training (C Basics) #include <stdio.h> int main() { int a = 4; printf("%d", (++a)++); return 0; }
  • 14.  Bitwise Operator: In C bitwise operator works at bit level. Operator Definition & Bitwise And | Bitwise Or ^ Bitwise XOR ~ Bitwise NOT >> Right Shift Operator << Left Shift Operator Technical Training (C Basics)
  • 15.  Bitwise Operator: points to remember- 1.Left and right shift operators should not be used for negative numbers. 2.if the number is shifted more than the size of integer the behavior is undefined. 3.The bitwise operator should not be used in place of logical operators. Technical Training (C Basics)
  • 16. What would be the output of the above code ? Choose the correct option. A. 4 B. error C. 5 D. Compiler dependent Technical Training (C Basics) #include <stdio.h> int main() { int i = 3; printf("%d", (++i)++); return 0; }
  • 17. Operators in ‘C’ In C language, operators are categorized in following six categories :  Logical Operator: Perform basic mathematical operations over one or more than one operands. Operator Definition && Logical And || Logical Or Technical Training (C Basics)
  • 18. Operators in ‘C’ In C language, operators are categorized in following six categories :  Assignment Operator:  It is a binary Operator  Evaluates the operator on Right side and assigns it to on Left side.  Example Technical Training (C Basics)
  • 19. Operators in ‘C’ In C language, operators are categorized in following six categories : Operators Type Associativity () [] -> . Left to right ! ~ ++ -- + - * & (type) sizeof Unary Right to left * / % Binary Left to right + - Binary Left to right << >> Binary Left to right < <= > >= Binary Left to right == != Binary Left to right & Binary Left to right ^ Binary Left to right | Binary Left to right && Binary Left to right || Binary Left to right ?: Binary Right to left = += -= *= /= %= &= |= ^= >>= <== Binary Right to left , Binary Left to right Technical Training (C Basics)
  • 20. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include <stdio.h> int a = 2; int a; int main(void) { printf("%d", a); int a; for(int i = 0 ; i < 3 ; i++ ) { printf("%d", a); a++; } printf("%d", a); return 0; } What would be the output of the above code ? Choose the correct option. A. 2 0 1 2 3 B. 2 2 2 2 3 C. 2 1 1 2 2 D. Compiler error Technical Training (C Basics) TCS
  • 21. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include <stdio.h> int a = 2; int a; int main(void) { printf("%d", a); int a; for(int i = 0 ; i < 3 ; i++ ) { printf("%d", a); a++; } printf("%d", a); return 0; } What would be the output of the above code ? Choose the correct option. A. 2 0 1 2 3 B. 2 2 2 2 3 C. 2 1 1 2 2 D. Compiler error Technical Training (C Basics) TCS
  • 22. 1 2 3 4 5 6 7 8 9 10 11 #include <stdio.h> int a = 12; int main(void) { for(int j = 0; j <= 1; j++) { int a = 4; a++; } printf("%d" , a); return 0; } What would be the output of the above code ? Choose the correct option. A. 4 B. 12 C. 5 D. Compiler error Technical Training (C Basics) Capegemini
  • 23. 1 2 3 4 5 6 7 8 9 10 11 #include <stdio.h> int a = 12; int main(void) { for(int j = 0; j <= 1; j++) { int a = 4; a++; } printf("%d" , a); return 0; } What would be the output of the above code ? Choose the correct option. A. 4 B. 12 C. 5 D. Compiler error Technical Training (C Basics) Capegemini
  • 24. 1 2 3 4 5 6 7 8 9 10 What would be the output of the above code ? Choose the correct option. A. 4 B. 5 C. 6 D. Error #include <stdio.h> int main(void) { for(int i = 0; i < 2; i++) { static int a = 4; a++; } printf("%d", a); return 0; } Technical Training (C Basics) TCS
  • 25. 1 2 3 4 5 6 7 8 9 10 What would be the output of the above code ? Choose the correct option. A. 4 B. 5 C. 6 D. Error #include <stdio.h> int main(void) { for(int i = 0; i < 2; i++) { static int a = 4; a++; } printf("%d", a); return 0; } Technical Training (C Basics) TCS
  • 26. 1 2 3 4 5 6 7 8 9 10 11 12 13 What would be the output of the above code ? Choose the correct option. A. 0 1 B. 2 3 C. 3 4 D. Error #include <stdio.h> int a; int main(void) { { a = 2; } for(int i = 0; i < 2; i++) { a++ ; printf("%d " , a); } return 0 ; } Technical Training (C Basics) Capegemini
  • 27. 1 2 3 4 5 6 7 8 9 10 11 12 13 What would be the output of the above code ? Choose the correct option. A. 0 1 B. 2 3 C. 3 4 D. Error #include <stdio.h> int a; int main(void) { { a = 2; } for(int i = 0; i < 2; i++) { a++ ; printf("%d " , a); } return 0 ; } Technical Training (C Basics) Capegemini
  • 28. 1 2 3 4 5 6 7 8 9 10 11 12 What would be the output of the above code ? Choose the correct option. A. 1 10 0 B. 1 10 1 C. 1 10 10 D. Error #include <stdio.h> int main(void) { int x = 1 ; printf("%d", x ); { int x = 10; printf("%d", x ); { x; printf("%d", x ); } } return 0; } Technical Training (C Basics) Infosys
  • 29. 1 2 3 4 5 6 7 8 9 10 11 12 What would be the output of the above code ? Choose the correct option. A. 1 10 0 B. 1 10 1 C. 1 10 10 D. Error #include <stdio.h> int main(void) { int x = 1 ; printf("%d", x ); { int x = 10; printf("%d", x ); { x; printf("%d", x ); } } return 0; } Technical Training (C Basics) Infosys
  • 30. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 What would be the output of the above code ? Choose the correct option. A. 20 20 B. 30 20 C. 10 20 D. 20 30 # include<stdio.h> int a = 10; int main(void) { { a = 30; { { a = 20; printf("%d", a); } } printf("%d", a); } return 0; } Technical Training (C Basics) Accenture
  • 31. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 What would be the output of the above code ? Choose the correct option. A. 20 20 B. 30 20 C. 10 20 D. 20 30 # include<stdio.h> int a = 10; int main(void) { { a = 30; { { a = 20; printf("%d", a); } } printf("%d", a); } return 0; } Technical Training (C Basics) Accenture
  • 32. 1 2 3 4 5 6 What would be the output of the above code ? Choose the correct option. A. 28 B. 25 C. 29 D. 30 #include<stdio.h> int main(void) { int a = 7; int s = a++ + ++a + a-- + a % 2; printf("%d", s); } Technical Training (C Basics) TCS
  • 33. 1 2 3 4 5 6 What would be the output of the above code ? Choose the correct option. A. 28 B. 25 C. 29 D. 30 #include<stdio.h> int main(void) { int a = 7; int s = a++ + ++a + a-- + a % 2; printf("%d", s); } Technical Training (C Basics) TCS
  • 34. 1 2 3 4 5 6 7 8 9 What would be the output of the above code ? Choose the correct option. A. 2 1 1 B. 3 2 1 C. 3 1 1 D. 2 2 1 #include<stdio.h> int main(void) { int i = 1, j = 2, k, l = 1; { k = i++ + ++i + j || l++; printf("%d %d %d", i, l, k); } return 0; } Technical Training (C Basics) Capegemini
  • 35. 1 2 3 4 5 6 7 8 9 What would be the output of the above code ? Choose the correct option. A. 2 1 1 B. 3 2 1 C. 3 1 1 D. 2 2 1 #include<stdio.h> int main(void) { int i = 1, j = 2, k, l = 1; { k = i++ + ++i + j || l++; printf("%d %d %d", i, l, k); } return 0; } Technical Training (C Basics) Capegemini
  • 36. 1 2 3 4 5 6 What would be the output of the above code ? Choose the correct option. A. 3 B. 4 C. 2 D. 1 #include <stdio.h> int main(void) { int a = 5; int s = a-- || a-- && 4; printf("%d", s); } Technical Training (C Basics) Infosys
  • 37. 1 2 3 4 5 6 What would be the output of the above code ? Choose the correct option. A. 3 B. 4 C. 2 D. 1 #include <stdio.h> int main(void) { int a = 5; int s = a-- || a-- && 4; printf("%d", s); } Technical Training (C Basics) Infosys
  • 38. 1 2 3 4 5 6 7 8 9 What would be the output of the above code ? Choose the correct option. A. 1 0 2 B. 1 1 3 C. 2 0 3 D. 2 1 2 #include<stdio.h> int main(void) { int i = 0, j = 2, k, l = 0; { k = (i++ && l++ ) || j++ + i++; printf("%d %d %d", i, l, j); } return 0; } Technical Training (C Basics) Accenture
  • 39. 1 2 3 4 5 6 7 8 9 What would be the output of the above code ? Choose the correct option. A. 1 0 2 B. 1 1 3 C. 2 0 3 D. 2 1 2 #include<stdio.h> int main(void) { int i = 0, j = 2, k, l = 0; { k = (i++ && l++ ) || j++ + i++; printf("%d %d %d", i, l, j); } return 0; } Technical Training (C Basics) Accenture
  • 40. 1 2 3 4 5 6 7 8 9 10 What would be the output of the above code ? Choose the correct option. A. 4 5 B. 4 4 C. 5 4 D. 5 5 #include<stdio.h> int main(void) { int i = 10, j = 10; int k = 4; { printf("%d", sizeof(k /= i+j)); printf("%d", k) ; } return 0; } Technical Training (C Basics) Infosys
  • 41. 1 2 3 4 5 6 7 8 9 10 What would be the output of the above code ? Choose the correct option. A. 4 5 B. 4 4 C. 5 4 D. 5 5 #include<stdio.h> int main(void) { int i = 10, j = 10; int k = 4; { printf("%d", sizeof(k /= i+j)); printf("%d", k) ; } return 0; } Technical Training (C Basics) Infosys