Please show detailed working and answer all of the following C programing multip
ID: 3831915 • Letter: P
Question
Please show detailed working and answer all of the following C programing multiple choice questions below:
10. Consider the following statements: int x = 6, y = 8, z, w; y = x++; z = ++x;
The value of x, y, z by calculating the above expressions are:
A. y = 8, z = 8, x = 6 B. y = 9, z = 7, x = 8 C. y = 9, z = 7, x = 8 D. y = 7, x = 8, z = 7
11. Which initialization is not performed by the following definition?
int b[2][2] = {{1}, {3, 4}};
A. b[0][0] is set to 1 B. b[0][1] is set to 1 C. b[1][0] is set to 3 D. b[1][1] is set to 4
12. Which of the following lines correctly defines a char variable?
A. char c = 'a'; C. B. char = a; char = 'a'; D. char c = a;
13. In a switch statement, the word ____ is optional and operates the same as the last else in an if- else chain.
A. if C. case B. break D. default
14. Which of the following statements about block (terminated) comments is true?
A. Block comments are a form of documentation B. Block comments must be coded on a single line C. Block comments start with a // token D. Block comments must start in column 1
15. The C programming language was developed by __________.
A. John Atanasoff C. Anders Hejlsberg B. John von Neumann D. Dennis Ritchie
Explanation / Answer
10. Consider the following statements: int x = 6, y = 8, z, w; y = x++; z = ++x;
The value of x, y, z by calculating the above expressions are:
Answer: Option D. y = 7, x = 8, z = 7
Program:
#include <stdio.h>
int main(void) {
int x = 6, y = 8, z, w;
z = ++x;
y = x++;
printf("value of y is : %d ",y);
printf("value of z is : %d ",z);
printf("value of x is : %d ",x);
return 0;
}
Output:
value of y is : 7
value of z is : 7
value of x is : 8
11. Which initialization is not performed by the following definition?
int b[2][2] = {{1}, {3, 4}};
Answer: Option B. b[0][1] is set to 1
Program:
#include <stdio.h>
int main(void) {
int b[2][2] = {{1}, {3, 4}};
printf("value of b[0][1] is : %d",b[0][1]);
return 0;
}
Output: value of b[0][1] is : 0
//Here value of b[0][1] is : 0 so Option B is wrong
12. Which of the following lines correctly defines a char variable?
Answer: Option A. char c = 'a';
Program:
#include <stdio.h>
int main(void) {
char c = 'a';
printf("value of c is : %c",c);
return 0;
}
Output:
value of c is : a
13. In a switch statement, the word ____ is optional and operates the same as the last else in an if- else chain.
Answer: D. default
14. Which of the following statements about block (terminated) comments is true?
Answer: C. Block comments start with a // token
15. The C programming language was developed by __________.
Answer: Option D.Dennis Ritchie
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.