0% found this document useful (0 votes)
4 views

Data Types and Operator _ DPP 03

The document is a GATE Computer Science & Information Technology practice paper focused on C programming, featuring multiple-choice questions related to data types and operators. It includes code snippets, expected outputs, and answer keys for various programming scenarios. Additionally, hints and solutions are provided for each question to aid understanding of the concepts tested.

Uploaded by

gravityingalaxy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Data Types and Operator _ DPP 03

The document is a GATE Computer Science & Information Technology practice paper focused on C programming, featuring multiple-choice questions related to data types and operators. It includes code snippets, expected outputs, and answer keys for various programming scenarios. Additionally, hints and solutions are provided for each question to aid understanding of the concepts tested.

Uploaded by

gravityingalaxy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1/18/25, 2:10 PM GATE_Computer Science & Information Technology_DPP 3

GATE

Computer Science & Information Technology


C - Programming
DPP: 3
Data Types & Operators

Q1 include <stdio.h> a=25>15>0!=12<45>42!= 65;


int main(void) printf("%d",a);
{ }
int a; The output is ______.
a = 2 * 6/5 + 3.0/2 + 1;
Q5 Consider the following program:
printf("%d", a);
#include<stdio.h>
return 0;
void main()
}
{
The value of a is ___
int a=0, b=1;
(A) 4.9 (B) 4.0
a=(a=5)&&(b=0);
(C) 4.5 (D) 4
printf("%d", a);
Q2 #include <stdio.h> printf("%d", b);
int main(void) }
{ The output is:
int a; (A) 50 (B) 00
a = 16.0 /4 * 5 % 3; (C) 10 (D) Compiler error
printf("%d", a);
Q6 Consider the following statements:
return 0;
P: The precedence of the modulus operator is
}
higher than multiplication or division operator.
The value of a printed is ___
Q: The result of the modulus operator contains
(A) Compiler error (B) 8.0
the sign of the second operand.
(C) 2 (D) 8
Which of the following statements is/are
Q3 Consider the following program. INCORRECT?
#include<stdio.h> (A) Only P
void main() (B) Only Q
{ (C) Both P and Q
int a; (D) Neither P nor Q
a=32>24>13>10>8>-1>0;
Q7 Consider the following program:
printf("%d",a);
#include<stdio.h>
}
void main()
The output is
{
Q4 #include<stdio.h> int a=2022;
void main() printf("%d%d%d", a!=2024, a=2023,
{ a==2021);
int a; }

Android App | iOS App | PW Website

https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 1/4
1/18/25, 2:10 PM GATE_Computer Science & Information Technology_DPP 3

GATE

The output is- void main()


(A) 020220 (B) 020231 {
(C) 002021 (D) 120230 int x=-2023;
printf("%d", ~(x=x+5)) ;
Q8 Consider the following program:
}
#include<stdio.h>
The output is __________.

Android App | iOS App | PW Website

https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 2/4
1/18/25, 2:10 PM GATE_Computer Science & Information Technology_DPP 3

GATE

Answer Key
Q1 (D) Q5 (B)

Q2 (A) Q6 (C)

Q3 1~1 Q7 (D)

Q4 1~1 Q8 2017~2017

Android App | iOS App | PW Website

https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 3/4
1/18/25, 2:10 PM GATE_Computer Science & Information Technology_DPP 3

GATE

Hints & Solutions


Q1 Text Solution: output : 1
a = 12/5 + 3.0/2 + 1
= 2 + 1.5 + 1 Q5 Text Solution:
= 4.5 int a=0, b=1;
a is an integer, so a = 4 a=(a=5)&&(b=0);
Q2 Text Solution: // Assignment operator assigns and returns the
a = 16.0/4 * 5 % 1 assigned value. So, a=5&&0=0, b=0
= 4.0 * 5 % 3 printf("%d", a);//0 is printed
= 20.0 % 3 printf("%d", b);//0 is printed.
= Error Q6 Text Solution:
Modulus operator works only with integers. P: INCORRECT. The precedence of the modulus
Q3 Text Solution: operator is same as multiplication or division
a = 32 > 24 > 13 > 10 > 8 > –1 > 0 operator.
1 > 13 Þ 0 > 10 Q: INCORRECT. The result of the modulus
0>8 operator contains the sign of the first operand.
0>–1 Q7 Text Solution:
1>0 a=2022. So, a!=2024 evaluates to 1.
1 a=2023. Assignment operator assigns the value
Q4 Text Solution: and returns the assigned value.
a = 25 > 15 > 0! = 12 < 45 > 42! = 65 a==2021 is equivalent to 2023==2021. So, it
1>0 evaluates to 0.
1! = 12 Output: 120230
1 < 45 Q8 Text Solution:
1 > 42 Þ 0! = 65 x=x+5 → x=-2023+5=-2018
1 ~(x) → ~(-2018) = -(-2018+1) = 2017.
a = 1; Output: 2017.

Android App | iOS App | PW Website

https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 4/4

You might also like