Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
194 views4 pages

Quiz 2

The document discusses 10 questions related to C programming. 1. The questions cover topics like switch case statements, relational and logical operators, data types, enumerations, and more. 2. Most questions provide code snippets and ask for the expected output, with multiple choice answers provided.

Uploaded by

Viraj Bhosale
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)
194 views4 pages

Quiz 2

The document discusses 10 questions related to C programming. 1. The questions cover topics like switch case statements, relational and logical operators, data types, enumerations, and more. 2. Most questions provide code snippets and ask for the expected output, with multiple choice answers provided.

Uploaded by

Viraj Bhosale
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/ 4

6. Framing is the responsibility of which layer in OSI model?

7. Service-point addressing is responsibility of which layer in OSI model?


8. Transmission mode used at Phyical layer can be ?
9. Which of the following protocols is used in E-mail
10. TCP and UDP protocols are operated on which layer of TCP/IP?1. Does follwing
code compile successfully
#include<stdio.h>
enum hello
{sunbeam,pune,karad; };
main()
{
enum hello a;
printf(�%d�,a);
}

1. No error
2. Error in the statement: {sunbeam,pune,karad; };
3. Error in the statement: enum hello a;
4. Error in the statement: printf(�%d�,a);

Answers:2

2. What is output of following program.


#include <stdio.h>

int main(void)
{
if((-1 && 1)&&( !printf("0")))
printf("%s","TRUE");
else
printf("%s","FALSE");

return 0;
}
Answers
1. TRUE
2. 0FALSE
3. FALSE
4. 0TRUE

Answers:2

3. What will be the output of following program ?


#include<stdio.h>

int main()
{
int i = 50;
if(~i>>7)
{
printf("Sunbeam,Pune");
}
else
{
printf("Sunbeam, Karad");
}

return 0;
}
Answers
1. Sunbeam,Pune
2. Sunbeam, Karad
3. Compile Time Error
4. No Output

Answer:1

4. What will be the output of following program ?

#include <stdio.h>
void main()
{
int a=10;
switch(a){
case 5+5:
printf(�Pune\n�);
default:
printf(�Karad\n�);
}
}
Answers
1. Pune
Karad
2. Pune
3. Karad
4. Compile time error.

answer:1

5. What will be the output of following program ?

#include<stdio.h>
enum menu
{ a=2,b,c,d=-1,e};
enum menu m;
int main()
{
printf(�%d %d�,b+a,e+d);
}
Answers
1. 2 3
2. 0 1
3. 5 -1
4. Error

answer:3

6. #include <stdio.h>

int main()
{
int var;

var=5>7?6:1!=8<9?50:60;

printf("%d", var);

return 0;
}
Answers
1. 6
2. 50
3. 1
4. 60

answer:4

7. #include<stdio.h>
int main()
{
int x = 100;
char y = 270;
if(x == y)
printf("x is equal to y\n");

else if(x > y)


printf("x is greater than y\n");

else if(x < y)


printf("x is less than y\n");
return 0;
}
Answers
1. complie time error
2. x is equal to y
3. x is less than y
4. x is greater than y

Answer:4

8. What will be the output of following program ?


#include<stdio.h>

int main()
{
char ch = 65;
switch(++ch)
{
case 'A':
printf("Hinjewadi\n");
break;
case 'B':
printf("MarketYard\n");
default:
printf("Karad\n");
break;
}
return 0;
}
Answers
1. MarketYard
Karad
2. Karad
3. Hinjewadi
4. Compile Time Error

Answer:1
9. In switch case the case values can be :
Answers
1. Integer
2. Float
3. Character
4. Both 1 & 3

answer:4

10. #include<stdio.h>
enum E_COURSE
{
EDAC,EDBDA,EDMC;
};
main()
{
enum E_COURSE x;
printf("%d",x);
}
Answers
1. No error
2. Error in the statement: EDAC,EDBDA,EDMC;
3. Error in the statement: enum E_COURSE x;
4. Error in the statement: printf(�%d�,x);

Answer:2

You might also like