C Programming Chapter 4

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is the output of this program 32 bit c compiler ?int main(){printf("%%%%\n");return 0;} No output Error %% %%%%%

%%

What is the meaning of the following C statement?scanf("%[^\n]s", ch); read only new line character read all character except new line syntax error read all characters

read all character except new line

What does the C statement given below says?scanf("%7s",ch); read string with any number of characters read string exactly to 7 characters read string with minimum 7 characters. read string with maximum 7 characters

read string with maximum 7 characters

What is the prototype of scanf function? scanf("controlstring",arg1,arg2,arg3,....,argn); scanf("control string", variable list); scanf(" varible list,", control string); scanf("arg1,arg2,arg3,....,argn", control string);

scanf("controlstring",arg1,arg2,arg3,....,argn);

scanf() is a predefined function in______header file. stdio. h ctype. h stdarg. h stdlib. h

stdio. h

scanf() is a predefined function in______header file. stdio. h ctype. h stdarg. h stdlib. h

stdio.h

What is the output of this program?#include <stdio.h># define scanf "%s Find best course "main(){printf(scanf, scanf);return 0;} Invalid Syntex%s Find best course Find best courseRun time error%s Find best course %s Find best course

%s Find best course Find best course

If the user enters 1 s 3.2, what value will be returned by the scanf()?scanf("%d %f %c", &a, &b, &c); no return value 2 3 1

1

What is the output of this program ?int main(){int i=-2;=i=i+i*i++;printf("%d",i);return 0;} 1 -2 -1 2

1

What is the output of this program?#include<stdio.h>int main(){int x = 1, y = 2;printf("%*d", x, y);return 0;} 1 Garbage Value 2 Compilation Error

1

What is the output of the following code?int main(){int k=1;printf("%d == 1 is" "%s\n", k, k==1?"TRUE":"FALSE");return 0;} K == 1 is FALSE 1 == 1 is TRUE k == 1 is TRUE 1 == 1 is FALSE

1 == 1 is TRUE

What is the output of this program?#include<stdio.h>int main(){char str[25];printf(" %d ",printf("c-letsfind"));return 0;} c-letsfind 10 9 c-letsfind 10 c-letsfind c-letsfind 9

10 c-letsfind

What is the output of this program ?int main(){char *p;p="%d\n";p++;p++;printf(p-2, 13);return 0;} No output 11 13 Error

13

Select the correct value of i from given options i=scanf("%d %d", &a, &b); 3 No value assigned 1 2

2

What is the output of the following code?int main() {int i=1;i=2+2*i++;printf("%d",i);return 0;} 3 2 4 5

4

What is the output of this program?main ( ){float a=4.1589;printf("%2.3f\n", a);return 0;} 4.159 4.000 4 4.200

4.159

What is the output of this program?main ( ){float a=4.1589;printf("%2.3f\n", a);return 0;} 44.1594.0004.200

4.159

What is the output of this program?main ( ){float a=4.1589;printf("%2.1f\n", a);return 0;} 4 4.0 4.2 4.1

4.2

What is the output of this program?main ( ){int i=2+3, 4>3, 1;printf( "%d" , i);} 5 4 3 1

5

What is the output of this program?int main(){int i=5;printf( "%d %d %d \n" , i,i<2,i>2);return 0;} Garbage value Compilation error 5 1 0 5 0 1

5 0 1

What is the output of this program?main ( ){int i=5;printf( "%d %d %d \n" , i,i<<2,i>>2);} Group of answer choices5 20 15 1 205 20 205 1 1

5 20 1 (glitched)

#include<stdio.h>int main(){ int a = 3; printf("%d"); return 0;}

Garbage Value

What is the output of this program ?#include<stdio.h>static struct student{int a;int b;}struct_var{2,3};int main(){printf("%d %d",struct_var.a,struct_var.b);return 0;} 2 3 Improper representation of structure variable Runtime Error Compilation error

It is not: Compilation Error

What is the output of this program? #include<stdio.h> int main() { printf("%d", 5.00); return 0; } Garbage Value Compilation error 0 5

It is not: Garbage Value

What is the output of this program ? #include<stdio.h>static struct student{int a;int b;}struct_var{2,3};int main(){printf("%d %d",struct_var.a,struct_var.b);return 0;}

It is not: compilation error

What is the output of this program?#include <stdio.h>int main(){int main = 3;printf("%d", main);return 0;} give garbage value 3 Compile time error Run time error

It is not: give garbage value compile time error

int main(){printf("%c\n", ~('W'*-1));return 0;} V S U T

V

What is the output of this program?#include<stdio.h>int main(){printf("%d",5.25);return 0;} 0 5 Compilation error Garbage value

give garbage value

Output of this statment is: printf("%d" , printf("hello"));

hello5

Control string specifies the type and format of the data that has to be obtained from the keyboard.

true


Conjuntos de estudio relacionados

Chapter 57: Management of Patients with Burn Injury - ML3

View Set

Ch.45 Mgmnt of pts w/ oral esophageal disorders

View Set

Chapter 18 - Caring for Clients with Cancer, Chapter 18: Caring for Clients with Cancer Prep -U

View Set