Quiz 2 Variables/Assignments

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

Which of the following format identifier is used to print or read a decimal integer value: @d !d %d #d

%d

What is the correct order of arithmetic operations in C: + - / * / + - * * + - / * / + -

* / + -

What is the correct order of operators?

Parentheses ,Unary, Arithmetic, Relational, Equality, Bitwise, Logical

What will be the output of the following code: #include<stdio.h> int main() { int num = 13 num++; printf("%d", num); return 0; } 14 12 13 15

14

What is the value of x in the following code segment: int x = 4 * 5 / 2 + 9; 1 19 1.8 8

19

What will be the output of the following code segment: printf("40 %%"); None of the above 40%% Compiler Error 40%

40%

What will be the output of the following code: #include<stdio.h> int main() { float val = 3.5 + 4.5; printf("%.3f", val); return 0; } 8.0 Compiler error 8.000 8

8.000

Which of the following statement decrements the variable data by 1: int data = 5; data--; data = data - 1; data - 1; Both a and b All of the above

Both a and b

%d is the format identifier used to print or read a double-floating point value. True False

False

A variable name should start with a digit or special character True False

False

% operator in C is used to perform which of the following functions: Division Multiplication Calculating percentage Modulus

Modulus

&variable is the address of the variable in the RAM True False

True

&variable is the address of the variable in the RAM: True False

True

A variable is a place holder in computer's RAM. True False

True

Assignment operator (=) has the lowest precedence than all the arithmetic operators True False

True

In programming, variable is a place to hold a value: True False

True

Modulus operator (%) can only operate on two whole numbers: True False

True

Unary minus or plus has higher precedence than multiplication, division, summation, and subtraction: True False

True

scanf() function is used to read data into a variable True False

True

sqrt(x) is a function of math library: True False

True

What is the output of the following code: #include <stdio.h> int main() { int num = 1 + 5/2; printf("Value of num is: %d", num); return 0; } 3 Value of num is: 3.5 Compiler error Value of num is: 3

Value of num is: 3

What is Camel case?

unitPrice or unit_price

Correct way of declaring a variable in C is: data_type variable_name(); data_type variable_name; variable_name data_type; variable_name = data_type;

data_type variable_name;

Increasing a variable's value by 1 is known as: Maximizing Adding Decrementing Incrementing

incrementing


Set pelajaran terkait

Leccion 4 Clasificar Choose the best category for each word and phrase.

View Set

AP Biology Practice Multiple Choice

View Set

Dynamic Business Law Exam 1 (quiz questions)

View Set