key2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A

a comment can be split over more than one line, as follows /** A program to calculate average of 5 numbers. **/ a.TRUE b.FALSE

A

a string is a ... array of characters terminated by a null('\0') a.one-dimensional b.two-dimensional

A

consider the following code: if(a==b) printf("\n the number are equal"); else(a<b) printf("\n the smaller number is: %d",a); else printf("\n the smaller number is: %d",b); in the above code, if a=14 and b=9, then the .... clause is executed a. else b.if c else if

B

given the below code int a=1; int i=7; if(a||i++) i++; printf("%d",i); what is the output a.7 b.8 c.9 d.other

B

in myfile.c does not exist, what will be output of this program? #include<stdio.h> main(){ FILE *fi; fi=fopen("myfile.c","r"); if(fi=NULL) {puts("file is not opened"); exit(1);} else puts("FILE opened");} a. file is not opened b.no output c.FILE opened d.error

D

the operation between float and int would give the result as a. float b. int c. unsigned int d.none of the above

C

what is the output when the sample code below is executed, assuming int data type is 32 bits in size? printf("%d, %d, %d, %d", sizeof(char), sizeof(int), sizeof(10.0), sizeof(10.0f)); a. 2,4,8,4 b. 1,10,10,10 c. 1,4,8,4 d. 1,4,4,4 e. 1,2,4,4

b

what is the output when the sample code below is executed? char mess[]="Your are welcome here"; char *p; p=mess; mess[8]='\0'; puts(++p); a.our are wel b.our are c.Your are d.Your are wel

D

what is the output when the sample code below is executed? int a=8, b=9; if(a%2=b%3) printf("\n%d %d", ++a, b--) a. 8 9 b. 9 9 c.9 8 d. compiler error e. 8 8

D

what is the output when the sample code below is executed? int a[5]={0}, x=2111223; while(x>10) { a[x%10-1]++; x/=10; } printf("%d",a[1]); a.6 b.3 c.1 d.2

E

what is the output when the sample code below is executed? int calc(int a, int b){ int x,y; x=a+b; y=a*b; return(x+y); } int main(){ int p=3, q=4, r, s; r=calc(p,q); s=calc(q,p); printf("\n%d%d",r,s); return 0;} a. 3 4 b. 17 19 c. 18 18 d. 17 17 e.19 19

D

what is the output when the sample code below is executed? int k=0x55; printf("\n%d",k); printf("\n"); a.65 b.75 c.55 d.85

B

what is the output when the sample code below is executed? int p,q,h; for(p=1;p<=3;p++) for(q=1;q<=2;q++) h=p+q; printf("%d\n",h); a.1 b.5 c.3 d.4 e.2

A

what will be printed when the sample code below is executed? char **buffer="0123456789"; char **ptr=buffer; ptr+=5; printf("%s\n",ptr); printf("%s\n",buffer); a. 56789 0123456789 b.56789 56789 c.0123456789 0123456789 d.5123456789 5123456789 e.0123456789 56789

D

what will the code below print when executed? double x=-3.5, y=3.5; printf("%.0f:%.0f\n",ceil(x), ceil(y)); printf("%.0f:%.0f\n",floor(x), floor(y)); a -3:3 -4:4 b.-4:3 -3:4 c.-4:4 -3:3 d.-3:4 -4:3 e.-4:3 -4:3

A

when does the code block following while(x<100) execute? a.when x is less than one hundred b.when x is equal to one hundred c.when x is greater than one hundred d.while it wishes

CD

which are the following statements printf % character? a.printf("\%") b.printf("\\%") c.printf("\%%") d.printf("%%")

c

which of the following can be used to append one string at the end of another a.strcpy b.strcmp c.strcat d.none of the above

ab

which of the following statement are true with regards to the || operator?(select all correct answer) a. this operator is used to combine two conditional expressions which evaluate to true as a whole only if either of the two expressions evaluate to true. b. only if both the expressions evaluate to false, the outcome is false c. if one of the conditional expressions return false, the outcome is false d. this operator is used to combine two logical expressions which evaluate to true if both individual expression are true

B

referring to the sample code below, what value will the variable counter have when completed int x=3, counter = 0; while(x-1){ ++counter; x--;} a.4 b.2 c.3 d.0 e.1


Ensembles d'études connexes

States + Capitals - West Side of the U.S.

View Set

Mental Health Exam 1 Prep-U Ch's 2, 5, 6, 7, 8, 10, 13, 14, 15, 16, 17, 18, 20, 24

View Set

BCA Chapter 4. Internet Review Questions

View Set

6.3 Explain the core concepts of Public Key Infrastructure

View Set

ch. 18 & 19 arteries, veins & functions of vessels

View Set