C Quiz

186
Powerpoint Templates Page 1 Powerpoint Templates Anjuman College of Engineering and Technology, Sadar, Nagpur. Computer Science and engineering department presents Envisage’13 “Over C War” By, Shabina Parveen

description

play a free C Language Quiz by choosing levels & test your knowledge.

Transcript of C Quiz

Page 1: C  Quiz

Powerpoint TemplatesPage 1

Powerpoint Templates

Anjuman College of Engineering and Technology, Sadar, Nagpur.

Computer Science and engineering department

presents

Envisage’13

“Over C War”By, Shabina Parveen

Page 2: C  Quiz

Powerpoint TemplatesPage 2

RULES Each Easy level question consists of 5

marks.Each Medium level question consists of 10

marksEach Hard level question consists of 15

marksAccording to the level chosen for betting,

for each correct answer plus marks & for each wrong answer respective marks will be deducted from the actual score

Page 3: C  Quiz

Powerpoint TemplatesPage 3

Categories

Easy

Medium

Hard

Page 4: C  Quiz

Powerpoint TemplatesPage 4

Question

Page 5: C  Quiz

Powerpoint TemplatesPage 5

Answer

Dennis Ritchie…

Page 6: C  Quiz

Powerpoint TemplatesPage 6

Categories

Easy

Medium

Hard

Page 7: C  Quiz

Powerpoint TemplatesPage 7

QuestionWould the following program give a

compilation error or warning?

#include<stdio.h> int main()

{

float I =10, *j;

void *k;

k = &I;

j = k;

printf(“%f\n”, *j);

return 0;

}

a. Yes b. No

Page 8: C  Quiz

Powerpoint TemplatesPage 8

Answer

b. No

Page 9: C  Quiz

Powerpoint TemplatesPage 9

Categories

Easy

Medium

Hard

Page 10: C  Quiz

Powerpoint TemplatesPage 10

QuestionPredict the output:

# define SQUARE(x) x*x;

inline float square(float y)

{

return y*y;

}

int main()

{

float a = 0.5, b = 0.5, c, d;

c= SQUARE (++a)l;

d = square (++b);

return 0;

}

Page 11: C  Quiz

Powerpoint TemplatesPage 11

Answer

Output: during preprocessing the macro SQUARE gets expanded into c=++x *++x;

You can notice the undesirable side effect in this macro expansion; the output is unpredictable because such side effect must not appear in inline function.

Page 12: C  Quiz

Powerpoint TemplatesPage 12

Categories

Easy

Medium

Hard

Page 13: C  Quiz

Powerpoint TemplatesPage 13

Question Which of the following statement

is true about the >> operator?

a. It divides a positive value by a power of two.

b. It multiplies a positive value by a power of two.

c. It adds a positive value with a power of two.

d. It subtracts from a positive value a power of two.

Page 14: C  Quiz

Powerpoint TemplatesPage 14

Answer

a. It divides a positive value by a power of two.

Page 15: C  Quiz

Powerpoint TemplatesPage 15

Categories

Easy

Medium

Hard

Page 16: C  Quiz

Powerpoint TemplatesPage 16

Question would the following code compile?

#include<stdio.h>

int main()

{

int a = 10, *j; a. Yes

void *k; b. no

j= k = &a;

j++;

k++;

printf(“%u %u\n , j, k”);

return 0;

}

Page 17: C  Quiz

Powerpoint TemplatesPage 17

Answer

b. No

Page 18: C  Quiz

Powerpoint TemplatesPage 18

Categories

Easy

Medium

Hard

Page 19: C  Quiz

Powerpoint TemplatesPage 19

QuestionPredict the output:

#include<stdio.h>

int main()

{

int a[]={0,1,2,3.4};

int i , *p;

for(p=arr,i=0; p+i<=arr+4 ; p++ , i++)

printf(“%d”, , *(p+1));

return 0;

}

Page 20: C  Quiz

Powerpoint TemplatesPage 20

Answer

Output: 024

Page 21: C  Quiz

Powerpoint TemplatesPage 21

Categories

Easy

Medium

Hard

Page 22: C  Quiz

Powerpoint TemplatesPage 22

Question Which of the following

statement is correct?

a. Int a=64<<2;

b. Float a =6.42<<2;

c. Double a = 3.33<<2;

d. Long double a =3.67<<2;

Page 23: C  Quiz

Powerpoint TemplatesPage 23

Answer

a. Int a=64<<2;

Page 24: C  Quiz

Powerpoint TemplatesPage 24

Categories

Easy

Medium

Hard

Page 25: C  Quiz

Powerpoint TemplatesPage 25

Question Would the following program give a compilation

error or warning?

#include<stdio.h>

int main()

{

int *p1, i=25; a. Yes

void *p2; b. no

p1=&i;

p2=&i;

p1=p2;

p2=p1;

return 0;

}

Page 26: C  Quiz

Powerpoint TemplatesPage 26

Answer

b. No

Page 27: C  Quiz

Powerpoint TemplatesPage 27

Categories

Easy

Medium

Hard

Page 28: C  Quiz

Powerpoint TemplatesPage 28

Question

• In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain?

• A. "I am a boy\r\n\0"

• B. "I am a boy\r\0"

• C. "I am a boy\n\0"

• D. "I am a boy"

Page 29: C  Quiz

Powerpoint TemplatesPage 29

Answer

C. "I am a boy\n\0"

Page 30: C  Quiz

Powerpoint TemplatesPage 30

Categories

Easy

Medium

Hard

Page 31: C  Quiz

Powerpoint TemplatesPage 31

Question

What would be the result of the expression a^a?

a. 0

b. 1

c. Sum of two operands

d. Multiplication of two operands

Page 32: C  Quiz

Powerpoint TemplatesPage 32

Answer

a. 0

Page 33: C  Quiz

Powerpoint TemplatesPage 33

Categories

Easy

Medium

Hard

Page 34: C  Quiz

Powerpoint TemplatesPage 34

Question Would the following program give a

compilation error or warning?

#include<stdio.h>

int main()

{

float *p1,i=25.50; a. Yes

char *p2; b. No

p1=&i;

p2=&i;

return 0;

}

Page 35: C  Quiz

Powerpoint TemplatesPage 35

Answer

a. Yes

Page 36: C  Quiz

Powerpoint TemplatesPage 36

Categories

Easy

Medium

Hard

Page 37: C  Quiz

Powerpoint TemplatesPage 37

Question

Write a program in C to display any message without using semi colon anywhere in program?

Page 38: C  Quiz

Powerpoint TemplatesPage 38

Answer

#include <stdio.h>

void main()

{

if(printf(”Hello”))

{}

NOTE: We can write the printf inside while or switch as well for same result.

Page 39: C  Quiz

Powerpoint TemplatesPage 39

Categories

Easy

Medium

Hard

Page 40: C  Quiz

Powerpoint TemplatesPage 40

QuestionWhat will be the output of the code

snippet given below:

#include<stdio.h>

Void main()

{

Int a =10,b =65;

Printf(“%d”,a<<(a&b));

}

a. 65 c. 0

d. 1 b. 10

Page 41: C  Quiz

Powerpoint TemplatesPage 41

Answer

b. 10

Page 42: C  Quiz

Powerpoint TemplatesPage 42

Categories

Easy

Medium

Hard

Page 43: C  Quiz

Powerpoint TemplatesPage 43

Question Predict the output:

#include<stdio.h>

int main()

{

int a[]={10,20,30,40,50};

int j;

for(j=0;j<5;j++)

{

printf(“%d\n”, *a);

a++;

}

return 0;

}

Page 44: C  Quiz

Powerpoint TemplatesPage 44

Answer

Output:

Error message: Lvalue required in function main

Page 45: C  Quiz

Powerpoint TemplatesPage 45

Categories

Easy

Medium

Hard

Page 46: C  Quiz

Powerpoint TemplatesPage 46

Question

#include<stdio.h>

int main()

{

char str[20] = "Hello";

char *const p=str;

*p='M';

printf("%s\n", str);

return 0;

}

Page 47: C  Quiz

Powerpoint TemplatesPage 47

Answer

MELLO

Page 48: C  Quiz

Powerpoint TemplatesPage 48

Categories

Easy

Medium

Hard

Page 49: C  Quiz

Powerpoint TemplatesPage 49

Question Who were the two main individuals

involved in development of K&R standard for C language?

a.Dennis Ritchie & John Von Neumann

b.Brian Kernighan & Dennis Ritchie

c. Grace Hopper & Niklaus Wirth

d.  Dennis Ritchie & Bjarne Stroustroup

Page 50: C  Quiz

Powerpoint TemplatesPage 50

Answer

Brian Kernighan and Dennis Ritchie

Page 51: C  Quiz

Powerpoint TemplatesPage 51

Categories

Easy

Medium

Hard

Page 52: C  Quiz

Powerpoint TemplatesPage 52

Question Predict the output:

#include<stdio.h>

int main()

{

float a[]={13.24, 1.5, 1.5, 5.4, 3.5};

float *j, *k;

j=a;

k=a+4;

i = j*2;

k =k/2;

printf(“%f %f\n”, *j. *k);

return 0;

}

Page 53: C  Quiz

Powerpoint TemplatesPage 53

Answer

Output:

Error message: illegal use of pointer in function main

Page 54: C  Quiz

Powerpoint TemplatesPage 54

Categories

Easy

Medium

Hard

Page 55: C  Quiz

Powerpoint TemplatesPage 55

Questionvoid main(){

int i=10;

static int x=i;

 if(x==i)

printf("Equal");

else if(x>i)

printf("Greater than");

else

printf("Less than");

}

Page 56: C  Quiz

Powerpoint TemplatesPage 56

Answer

 

Compiler error

Page 57: C  Quiz

Powerpoint TemplatesPage 57

Categories

Easy

Medium

Hard

Page 58: C  Quiz

Powerpoint TemplatesPage 58

Question

Which of the following utility is used for compiling and linking the program?

a. Make

b. Makefile

c. Compiler

d. linker

Page 59: C  Quiz

Powerpoint TemplatesPage 59

Answer

a. Make

Page 60: C  Quiz

Powerpoint TemplatesPage 60

Categories

Easy

Medium

Hard

Page 61: C  Quiz

Powerpoint TemplatesPage 61

Question Would the following program give a

compilation error or warning?

#include<stdio.h>

int main()

{

char a[]=”sunstroke”; a. Yes

char *p = “coldwave”; b. Noa = “coldwave”;

p = “sunstroke”;

printf(“%s %s\n”, a, p);

return 0;

}

Page 62: C  Quiz

Powerpoint TemplatesPage 62

Answer

b. No

Page 63: C  Quiz

Powerpoint TemplatesPage 63

Categories

Easy

Medium

Hard

Page 64: C  Quiz

Powerpoint TemplatesPage 64

Question

Write a c program to add two

numbers without add operator?

Page 65: C  Quiz

Powerpoint TemplatesPage 65

Answer

#include <stdio.h>

#include <conio.h>

int main(){

int a=1,b=2,c;

c=a-(-b);

printf(“%d”,c);

getch();

return 0;

}

Page 66: C  Quiz

Powerpoint TemplatesPage 66

Categories

Easy

Medium

Hard

Page 67: C  Quiz

Powerpoint TemplatesPage 67

Question

Which of the following function is used to copy data types other than strings from one variable to another?

a. memcpy() c. objcpy()

b. datacpy() d. strcpy()

Page 68: C  Quiz

Powerpoint TemplatesPage 68

Answer

a. memcpy()

Page 69: C  Quiz

Powerpoint TemplatesPage 69

Categories

Easy

Medium

Hard

Page 70: C  Quiz

Powerpoint TemplatesPage 70

Question

Predict the output:

#include<stdio.h>

#include<string.h>

int main()

{

char s[]=”rendezvous !”;

printf(“%d\n”, *(s + strlen (s)));

return 0;

}

Page 71: C  Quiz

Powerpoint TemplatesPage 71

Answer

Output: 0

Page 72: C  Quiz

Powerpoint TemplatesPage 72

Categories

Easy

Medium

Hard

Page 73: C  Quiz

Powerpoint TemplatesPage 73

QuestionWhat will be the output of the

code snippet given below?

#include<stdio.h>

Void main()

{

Char ch = ‘A’;

Printf(“%d”, ch | ‘A’ & ‘Z’);

}

Page 74: C  Quiz

Powerpoint TemplatesPage 74

Answer

65

Page 75: C  Quiz

Powerpoint TemplatesPage 75

Categories

Easy

Medium

Hard

Page 76: C  Quiz

Powerpoint TemplatesPage 76

Question Consider the following program

segment: int a=35;

int *b;

b= &a;

A. b contains address of an int

B. value at address contained in b is an int.

C. b is a pointer which points in the direction of an int.

D. all of the above

Page 77: C  Quiz

Powerpoint TemplatesPage 77

Answer

d. all of the above

Page 78: C  Quiz

Powerpoint TemplatesPage 78

Categories

Easy

Medium

Hard

Page 79: C  Quiz

Powerpoint TemplatesPage 79

Question

Predict the output:

#include<stdio.h>

#include<string.h>

int main()

{

printf(5 + “fascimile”);

return 0;

}

Page 80: C  Quiz

Powerpoint TemplatesPage 80

Answer

Output: mile

Page 81: C  Quiz

Powerpoint TemplatesPage 81

Categories

Easy

Medium

Hard

Page 82: C  Quiz

Powerpoint TemplatesPage 82

Question

Predict the output:

#define call(x) #x

void main(){

   printf("%s",call(c/c++));

}

Page 83: C  Quiz

Powerpoint TemplatesPage 83

Answer

c/c++

Page 84: C  Quiz

Powerpoint TemplatesPage 84

Categories

Easy

Medium

Hard

Page 85: C  Quiz

Powerpoint TemplatesPage 85

Question

In which header file is the NULL macro defined?

a. <stdio.h>

b. <stddef.h>

c. # define

d. All of the above

Page 86: C  Quiz

Powerpoint TemplatesPage 86

Answer

c. All of the above

Page 87: C  Quiz

Powerpoint TemplatesPage 87

Categories

Easy

Medium

Hard

Page 88: C  Quiz

Powerpoint TemplatesPage 88

Question

Predict the output:

#include<stdio.h>

int main()

{

int arr[12];

printf(“%d\n”, sizeof(arr));

return 0;

}

Page 89: C  Quiz

Powerpoint TemplatesPage 89

Answer

Output: 24

Page 90: C  Quiz

Powerpoint TemplatesPage 90

Categories

Easy

Medium

Hard

Page 91: C  Quiz

Powerpoint TemplatesPage 91

Questionstruct marks{

int p:3;

int c:3;

int m:2;

};

void main()

{

struct marks s={2,-6,5};

printf("%d %d %d",s.p,s.c,s.m);

}

Page 92: C  Quiz

Powerpoint TemplatesPage 92

Answer

2 2 12 2 1

Page 93: C  Quiz

Powerpoint TemplatesPage 93

Categories

Easy

Medium

Hard

Page 94: C  Quiz

Powerpoint TemplatesPage 94

Question

Is the NULL pointer same as an uninitialized pointer ?

a. Yes

b. No

Page 95: C  Quiz

Powerpoint TemplatesPage 95

Answer

b. No

Page 96: C  Quiz

Powerpoint TemplatesPage 96

Categories

Easy

Medium

Hard

Page 97: C  Quiz

Powerpoint TemplatesPage 97

Question

What is the current version of standard for c language was approved in December 2011?

Page 98: C  Quiz

Powerpoint TemplatesPage 98

Answer

C11

Page 99: C  Quiz

Powerpoint TemplatesPage 99

Categories

Easy

Medium

Hard

Page 100: C  Quiz

Powerpoint TemplatesPage 100

Question

Predict the output:

void main(){

 int a=25;

   clrscr();

   printf("%o %x",a,a);

   getch();

}

Page 101: C  Quiz

Powerpoint TemplatesPage 101

Answer

31 19

Page 102: C  Quiz

Powerpoint TemplatesPage 102

Categories

Easy

Medium

Hard

Page 103: C  Quiz

Powerpoint TemplatesPage 103

Question

State true or false:

Multiplication of a pointer and an unsigned integer is allowed

a. True

b. false

Page 104: C  Quiz

Powerpoint TemplatesPage 104

Answer

b. False

Page 105: C  Quiz

Powerpoint TemplatesPage 105

Categories

Easy

Medium

Hard

Page 106: C  Quiz

Powerpoint TemplatesPage 106

Question

• In which numbering system can the binary number 1011011111000101 be easily converted to?

A. Decimal system

B. Hexadecimal system

C. Octal system

D. No need to convert

Page 107: C  Quiz

Powerpoint TemplatesPage 107

Answer

Hexadecimal system

Page 108: C  Quiz

Powerpoint TemplatesPage 108

Categories

Easy

Medium

Hard

Page 109: C  Quiz

Powerpoint TemplatesPage 109

Question

Predict the output:

void main()

{

 int a=-12;

 a=a>>3;

printf("%d",a);

}

Page 110: C  Quiz

Powerpoint TemplatesPage 110

Answer

-2

Page 111: C  Quiz

Powerpoint TemplatesPage 111

Categories

Easy

Medium

Hard

Page 112: C  Quiz

Powerpoint TemplatesPage 112

Question

Does mentioning the array name gives the base address in all the contexts?

a. Yes

b. no

Page 113: C  Quiz

Powerpoint TemplatesPage 113

Answer

b. No

Page 114: C  Quiz

Powerpoint TemplatesPage 114

Categories

Easy

Medium

Hard

Page 115: C  Quiz

Powerpoint TemplatesPage 115

Question

• What is the difference between #include <> and #include “ ” ?

Page 116: C  Quiz

Powerpoint TemplatesPage 116

Answer

#include <> ---- > specifically used for built in header file.

#include ” ” ----->specifically used for user defined/created n header files.

Page 117: C  Quiz

Powerpoint TemplatesPage 117

Categories

Easy

Medium

Hard

Page 118: C  Quiz

Powerpoint TemplatesPage 118

Question

Assuming, integer is 2 byte, What will be the output of the program?

#include<stdio.h>

int main()

{

printf("%x\n", -1>>1);

return 0;

}

Page 119: C  Quiz

Powerpoint TemplatesPage 119

Answer

ffff

Page 120: C  Quiz

Powerpoint TemplatesPage 120

Categories

Easy

Medium

Hard

Page 121: C  Quiz

Powerpoint TemplatesPage 121

Question

A pointer to a block of memory is effectively same as the array

a. True

b. False

Page 122: C  Quiz

Powerpoint TemplatesPage 122

Answer

a. True

Page 123: C  Quiz

Powerpoint TemplatesPage 123

Categories

Easy

Medium

Hard

Page 124: C  Quiz

Powerpoint TemplatesPage 124

Question

Find the ERROR:

void main()

{

int const * p=5;

printf("%d",++(*p));

}

Page 125: C  Quiz

Powerpoint TemplatesPage 125

Answer

Compiler error: Cannot modify a constant value.

Page 126: C  Quiz

Powerpoint TemplatesPage 126

Categories

Easy

Medium

Hard

Page 127: C  Quiz

Powerpoint TemplatesPage 127

Question

Predict the output:

#include "string.h"

void main(){

 clrscr();

printf("%d%d",sizeof("string"),strlen("string");

getch();

}

Page 128: C  Quiz

Powerpoint TemplatesPage 128

Answer

7 6

Page 129: C  Quiz

Powerpoint TemplatesPage 129

Categories

Easy

Medium

Hard

Page 130: C  Quiz

Powerpoint TemplatesPage 130

Question What does the following

declaration mean:

a. index of the pointer variable

b. memory location as 10

c. ptr is a pointer to an array of 10 integers

d. none of the above

Page 131: C  Quiz

Powerpoint TemplatesPage 131

Answer

c. ptr is a pointer to an array of 10 integers

Page 132: C  Quiz

Powerpoint TemplatesPage 132

Categories

Easy

Medium

Hard

Page 133: C  Quiz

Powerpoint TemplatesPage 133

Question

Two different operators would always have different Associativity.

A. Yes B. No

Page 134: C  Quiz

Powerpoint TemplatesPage 134

Answer

NO

Page 135: C  Quiz

Powerpoint TemplatesPage 135

Categories

Easy

Medium

Hard

Page 136: C  Quiz

Powerpoint TemplatesPage 136

QuestionPredict the output:

#include<stdio.h>

void main()

{

int i;

For(i=0;i++<10;)

Printf(“%d\n”,i);

}

Page 137: C  Quiz

Powerpoint TemplatesPage 137

Answer

2

3

4

5

6

7

8

9

10

Page 138: C  Quiz

Powerpoint TemplatesPage 138

Categories

Easy

Medium

Hard

Page 139: C  Quiz

Powerpoint TemplatesPage 139

Question

Predict the output:

#include<stdio.h>

int main()

{

printf(“%c”, “abcdefgh”[4]);

return 0;

}

Page 140: C  Quiz

Powerpoint TemplatesPage 140

Answer

0

Page 141: C  Quiz

Powerpoint TemplatesPage 141

Categories

Easy

Medium

Hard

Page 142: C  Quiz

Powerpoint TemplatesPage 142

Question

• Data written into a file using fwrite() can be read back using fscanf()

A. True B. False

Page 143: C  Quiz

Powerpoint TemplatesPage 143

Answer

FALSE

Page 144: C  Quiz

Powerpoint TemplatesPage 144

Categories

Easy

Medium

Hard

Page 145: C  Quiz

Powerpoint TemplatesPage 145

Question

What the following code will display?

void main()

{

   printf("%s",__DATE__);

}

Page 146: C  Quiz

Powerpoint TemplatesPage 146

Answer

Current system DATE

Page 147: C  Quiz

Powerpoint TemplatesPage 147

Categories

Easy

Medium

Hard

Page 148: C  Quiz

Powerpoint TemplatesPage 148

Question

Predict the output:

#include<stdio.h>

int main()

{

char str[7] = “strings”;

printf(“%s\n” , str);

return 0;

}

Page 149: C  Quiz

Powerpoint TemplatesPage 149

Answer

Output: cannot predict

Page 150: C  Quiz

Powerpoint TemplatesPage 150

Categories

Easy

Medium

Hard

Page 151: C  Quiz

Powerpoint TemplatesPage 151

QuestionWhat do the functions atoi()?

A. is a macro that converts integer to character.

B. It converts an integer to string

C. It converts a floating point number to string

Page 152: C  Quiz

Powerpoint TemplatesPage 152

Answer

is a macro that converts integer to character

Page 153: C  Quiz

Powerpoint TemplatesPage 153

Categories

Easy

Medium

Hard

Page 154: C  Quiz

Powerpoint TemplatesPage 154

QuestionPredict the output:

void main()

{

   printf("%s","c" "question" "bank");

}

A. c question bank

B. bank

C. cquestionbank

D. Compiler error

Page 155: C  Quiz

Powerpoint TemplatesPage 155

Answer

cquestionbank

Page 156: C  Quiz

Powerpoint TemplatesPage 156

Categories

Easy

Medium

Hard

Page 157: C  Quiz

Powerpoint TemplatesPage 157

Question Would the following code

compile successfully?

# include<stdio.h>

int main()

{

printf(“%c”, 7[“sundaram”]);

return 0;

}

Page 158: C  Quiz

Powerpoint TemplatesPage 158

Answer

Ans: Yes

Page 159: C  Quiz

Powerpoint TemplatesPage 159

Categories

Easy

Medium

Hard

Page 160: C  Quiz

Powerpoint TemplatesPage 160

Question

Give the output:

main(){#define a 50printf("%d",a);}

Page 161: C  Quiz

Powerpoint TemplatesPage 161

Answer

50

Page 162: C  Quiz

Powerpoint TemplatesPage 162

Categories

Easy

Medium

Hard

Page 163: C  Quiz

Powerpoint TemplatesPage 163

QuestionGive the output:

void main(){

 char *str="c-pointer";

  printf("%*.*s",10,7,str);

}

(a. c-pointer

b. c-pointer

c. c-point

d. cpointer null null

Page 164: C  Quiz

Powerpoint TemplatesPage 164

Answer

c-point

Page 165: C  Quiz

Powerpoint TemplatesPage 165

Categories

Easy

Medium

Hard

Page 166: C  Quiz

Powerpoint TemplatesPage 166

Question

Which of the following statements are correct about the program?

#include<stdio.h>

int main()

{

printf("%p\n", main());

return 0;

}

Page 167: C  Quiz

Powerpoint TemplatesPage 167

Answer

It prints garbage values infinitely

Page 168: C  Quiz

Powerpoint TemplatesPage 168

Categories

Easy

Medium

Hard

Page 169: C  Quiz

Powerpoint TemplatesPage 169

Question• Find the error:typedef struct

{

int data;

NODEPTR link;

}*NODEPTR;

Page 170: C  Quiz

Powerpoint TemplatesPage 170

Answer

Error: typedef cannot be used until is define

Page 171: C  Quiz

Powerpoint TemplatesPage 171

Categories

Easy

Medium

Hard

Page 172: C  Quiz

Powerpoint TemplatesPage 172

Question

• Predict the output:

#include<stdio.h>

void main()

{

int i;

For(i=0;++i<=10;)

Printf(“%d\n”,i);

}

Page 173: C  Quiz

Powerpoint TemplatesPage 173

Answer

1

2

3

4

5

6

7

8

9

Page 174: C  Quiz

Powerpoint TemplatesPage 174

Categories

Easy

Medium

Hard

Page 175: C  Quiz

Powerpoint TemplatesPage 175

QuestionPredict the output: #include<stdio.h>

#include<string.h>

Int main

{

Char str1[]=“learn through IndiaBIX\0.com”, str2[120];

Char *p;

P=(char*)memccpy(str2,str1,’I’,strlen(str1));

*p=‘\0’;

Printf(“%s”,str2);

Return 0;}

Page 176: C  Quiz

Powerpoint TemplatesPage 176

Answer

“learn through indi”

Page 177: C  Quiz

Powerpoint TemplatesPage 177

Categories

Easy

Medium

Hard

Page 178: C  Quiz

Powerpoint TemplatesPage 178

Question

State true or false:

• In place of the condition in a while loop structure there can be any other valid expression

Page 179: C  Quiz

Powerpoint TemplatesPage 179

Answer

True

Page 180: C  Quiz

Powerpoint TemplatesPage 180

Categories

Easy

Medium

Hard

Page 181: C  Quiz

Powerpoint TemplatesPage 181

Question

Predict the output:

#include<stdio.h>

Void main()

{

Char arr[7]=“NETWORK”;

Printf(“%s”,arr);

}

Page 182: C  Quiz

Powerpoint TemplatesPage 182

Answer

Garbage value

Page 183: C  Quiz

Powerpoint TemplatesPage 183

Categories

Easy

Medium

Hard

Page 184: C  Quiz

Powerpoint TemplatesPage 184

Question

• What does the above flowchart shows?

Initialize

Test

Body of loop

increement

Stop

START

False

True

Page 185: C  Quiz

Powerpoint TemplatesPage 185

Answer

Shows the flowchart of FOR LOOP

Page 186: C  Quiz

Powerpoint TemplatesPage 186

Categories

Easy

Medium

Hard