Last Updated on October 18, 2019 by Admin
CLA – Programming Essentials in C Quizzes Chapter 2 Assessment Exam Answers Full 100%
-
Which of the following strings is a proper integer number (in the “C” language sense)?
- 123456
- 123_456
- 123.456
- 123,456
-
What is the value of the following integer literal?
08
- the literal is invalid
- 10
- 1000
- 8
-
What is the value of the following integer literal?
0x8
- the literal is invalid
- 10
- 1000
- 8
-
Which of the following strings is a valid variable name?
- Monte_Carlo
- Monte Carlo
- Monte@Carlo
- Monte-Carlo
-
Which of the following strings is an invalid variable name?
- _0_
- _0
- 0_
- ___
-
Is the following declaration valid?
int var, var;
- Yes
- No
-
What is the value of the var variable at the end of the following snippet?
int var; var = 2; var = var * var; var = var + var; var = var / var; var = var % var;
- 16
- 8
- 1
- 0
-
What is the value of the var variable at the end of the following snippet?
int var; var = 2; var = var * var; var = var + var; /* var = var / var; var = var % var; */
- 16
- 1
- 8
- 0
-
Which of the following strings is a proper floating-point number (in the ”C” language sense)?
- 123_456
- 123456
- 123,456
- 123.456
-
What is the value of the following floating-point literal?
8765E-2
- 876.5
- 8.765
- 0.8765
- 87.65
-
What is the value of the x variable at the end of the following snippet?
int x; x = 1 / 2;
- 0.5
- 1
- 0
- 2
-
What is the value of the x variable at the end of the following snippet?
int x; x = 1 / 2 * 3; /***
- 0
- 1.5
- 1
- 2
-
What is the value of the x variable at the end of the following snippet?
float x; x = 1. / 2 * 3; /***
- 2
- 1.5
- 1
- 0
-
What is the value of the k variable at the end of the following snippet?
int i,j,k; i = 4; j = 5; --i; k = i * j;
- 12
- 18
- 16
- 15
-
What is the value of the k variable at the end of the following snippet?
int i,j,k; i = 4; j = 5; ++j; k = i * j;
- 21
- 24
- 28
- 18
-
What is the value of the k variable at the end of the following snippet?
int i,j,k; i = 3; j = -3; k = i * j; k += j; k /= i;
- -4
- 8
- 8
- 4
-
What is the value of the c variable at the end of the following snippet?
char c; c = '\';
- ‘
- \0
- the assignment is invalid and causes a compilation error
- \
-
What is the value of the c variable at the end of the following snippet?
char c; c = 'a'; c -= ' ';
- a
- A
- \0
- the assignment is invalid and causes a compilation error
-
What is the value of the k variable at the end of the following snippet?
int i,j,k; i = 3; j = -3; k = (i >= i) + (j <= j) + (i == j) + (i > j);
- 2
- 3
- 0
- 1
-
What happens if you try to compile and run this program?
#include <stdio.h> int main(void) { int i,j,k; i = 2; j = -2; if(i) i--; if(j) j++; k = i * j; printf("%d",k); return 0; }
- -1
- 2
- 1
- -2