330

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which operator is used to determines that the operands are not the same of the value? A. =! B. == C. !

!=

What is the value of variable s after execution of the program fragment below?char h[6] = "wild";char p[6] = "crazy";char s[10];strcpy(s, h);strcat(s, p);

"wildcrazy"

bitwiser operators & ! 1= >= <=

& and ! or not equal greater than not equal

Valid C comments

// */ \*

What will be the output of this program fragment?int value = 0;do{printf("%d", value);value = value + 2;}while (value <5);

024

What will be the output of this program fragment?int value = 1;do{printf("%d\n", value);value = value + 2;}while (value <5);

1 3

What will be the output of the following?#include <stdio.h>struct p {int k;char c; };int p = 10;int main() {struct p x;x.k = 10;printf("%d %d\n", x.k, p);}

10 10

For what exact range of values of variable x does the following code segment display the letter 'C'?if (x <= 200)if (x < 100)if (x <= 0)printf("A\n");elseprintf("B\n");elseprintf("C\n");elseprintf("D\n");

100<=x<=200

What is the output of the following program fragment?double x[8] = {16.0, 12.0, 6.0, 8.0, 2.5, 12.0, 12.0, -54.5};int j = 5;printf("%.2f\t", x[j] + 1);printf("%.2f\t", x[j + 1]);

13.00 14.00

What is the output of the following program::#include<stdio.h>struct Point{int x, y, z;};int main() {struct Point p1 = {.y = 0, .z = 1, .x = 2};printf("%d %d %d", p1.x, p1.y, p1.z);return 0;}

2 0 1

What is the output of the following code fragment?int x = 0;while (x<=3){printf("%d\t", x + 2);x++;}

2 3 4 5

What is the output of the following program?#include <stdio.h>void bing(int n){printf("%4d", n);}int main(void){double x;x = 41;bing(x);printf("%.2f\n", x);return (0);}

41 41.10

Given the following:#define MAX 50int a[MAX];What is the maximum valid subscript value for array a?

49

How many numbers can be stored in the array declared below?double arr[10][5];

50

How many times is the loop body of the while statement executed?int g = 0;int s = 0;int z = 0;int i = 0;while (i <=5){scanf("%d", &t);s = s+ t;if (t >= 0);g = g + 1;elsez = z + 1;i = i + 1;} a 5 b 6 c 8

6

How many times is the loop body of the while statement executed?int g = 0;int s = 0;int z = 0;int i = 0;while (i <=5){scanf("%d", &t);s = s+ t;if (t >= 0);g = g + 1;elsez = z + 1;i = i + 1;} 5 times 7 times 6 times

6 times

The function _ comprises one or more statements that are excuted when the function is called?

Body

What does the following function do?int func (int n) {int ans;if (n == 1)ans = 1;elseans = n + func(n-1);return (ans);}

Computes (addition of numbers .. (n-1) + n) using a recursive definition

Double

Fractional part like 3.14

Consider the following code fragment.char str[10]; scanf("%s", str);What will happen if scanf encounters the string "vivaciously" when scanning a value for str?

Function scanf will store the entire string "vivaciously", even though there is insufficient space in str. The string will overflow st

Which statments are true

Identifiers must start with a letter or underscore(_) .They are case sensitive. No space character is allowed in an identifier.

What will be the output of this program fragment?int i;for(i = 0; i = 1; ++i){printf("ans1");printf("ans2");}

Infinite loop

1011000 is a?

Machine Language

The execution of a C program starts with the ____ function. A. Main B INT C Int main

Main

Variable

Name associated with memory cell

Variable Dec

Name that communicates with compiler

What is not a variable data type? A. character B. Integer C. Number

Number

What type operators are these? <>==? A.)Relational B.)Variables C.)Functions

Relational

Each C function is made of a sequence of _ A Characters B Int C Stateemnts

Statements

The term that is used for a set of rules that is followed by a strict A Syntax B Variable C Integer

Syntax

Reserved word

Word that has a special meaning

What is the output of the following program fragment? int a=4;void write(){int a=10;printf("a = %d", a);}int main(){int a = 5;write();printf("a = %d", a);return 0;} 5 4 3

a=5

binary operator

an operator with two operands

What is the output of the following code fragment?int i;for(i = 0; i<2; i++){printf("ans1");printf("ans2");

ans1ans2ans1ans2

When the elements in an array are stored from lowest to highest, the array is sorted in __________ order. ascending descing

ascending

What will be the output of this program fragment?char u, v, temp; u = 'a'; v = 'b';while (v != 'a'){temp = u;u = v;v = temp;}

ba

constant variables

can be used to specify array sizes, thereby making programs more scalable.

The function prototype double mySqrt(int x);

defines a function called mySqrt which takes an integer as an argu-ment and returns a double

The if statementif (13 < 12)printf("never\n");elseprintf("always\n"); never display alwasy display

displays always

Which of the following code segments does not contain any errors? Selected Answer :Correct1: double triple(float n) {return (3 * n);} 2: void printnum (int x){print("%i", x);return x;} 3: int cube(int s){int s;return (s s s);} 4: double circumference (int r)return (3.14 2 r);

double triple(float n) {return (3 * n);}

20 * 40 is a

expression

Given below prototype of a function:void five(double x, double yp, int zp);Given these variable declarations:int m, n;double p, q;What could be a valid call to function five()?term-23

five(6.2, &p, &n);

what is an else statement

it is there if the if statement fails

a word with predefined meanings in c

keywoad

How many times will the following loop iterate?int j = 1;while (j>5){printf("%d", j);} one no

no

What is the output of the following code fragment? nt x; char z = ' b '; if (x = z) printf("One") ;elseprintf("Two"); none one two

one

What is the subscript index for the data value 92 in the example given below?int score [5] = {83, 92, 78, 94, 71}

one

What does the following function do?int func(int m, int n) {int ans;if (n == 0)ans = m;elseans = 1 + func(m, n-1);return (ans);} performs one interger addition preforms two interger addition

performs two integer addition

In C, it is appropriate to say that a string is a(n) ________ statment int main pointer

pointer

If the printf function is passed a character array that is not null terminated it will

print the contents of the character array and keep printing characters in memory until it encounters a null character

Which function does NOT read data from standard input? int char printf

printf

What is the right way to access values of structure variable book{ price, page }?

printf("%d%d", book.price, book.page);

int square(int); is an example of a function ________. syntax protoype

prototype

which of the following is optionall when writing a function definition

return statment

GIven the following structure definition:struct part {unsigned int partNumber;char partName[25];} ;Reading the a part number and the a part name from the keyboard into the individual members of a structure part variable called a

scanf("%d%24s", &a.partNumber, a.partName);

a named memory chunk to store value of a specific type stores values for later use

variable

Given that x and y are two int variables that have been declared and initialized, which of the following statements will result in a syntax error?

x + = y;

unary operator

x =-y an operator with one operand


Set pelajaran terkait

Business Principles 1301: Chapter 1

View Set

Habitat Requirements of Wildlife

View Set

Inquizitive: Chapter 17. Social Policy

View Set

Entrepreneurship and Small Business Management

View Set

Chapter 3 - Breathing Gas and the Effects on Your Body

View Set

Immuny - ćw 5 (najważniejsze zagadnienia)

View Set

Social Problems SOCI-202 Midterm

View Set