Please Turn On Java Script To Access This Site.

C Institute | Questions


Previous Topic : Logical Operators - 1Next Topic : Assignment Operator - 1

This section on C interview questions, tricky questions, and puzzles focuses on “Logical operators”. One shall practice these questions and puzzles to improve their C programming skills needed for various interviews (campus interviews, walk-in interviews, viva exams and company interviews), placements, entrance exams and other competitive exams. These programming questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate, engineering student, bca student, mca student, mcs students or an experienced IT professional. Here is a listing of C questions and puzzles on “Logical operators” along with answers and/or explanations.

Q1: What will be the output of following program ?
#include <stdio.h>
void main()
{       int x=(20 || 40 ) && (10);
	printf("x=%d",x);
}
a)  x=70
b)  x=10
c)  x=1
d)  x=0
Correct Answer : c
Explanation : 1)(20 || 40) .... both are non zero values, will return 1.
2)(1) && 10 .... both are non zero values, hence output will be 1.


Previous Topic : Logical Operators - 1Next Topic : Assignment Operator - 1