Question
1
Which
of the
following statements is syntactically correct in C?
A) print("Winter is coming.");
B) printf("Winter "+"is"+”coming.”);
C) printf(Winter is coming.);
D) printf("Winter is coming.");
E) None of the Above
Question 2
What
is the percent
code used in
scanf
for an
character?
A) %c
B) %f
C) %d
D) %lf
E) None of the Above
Question 3
What is the value of the following arithmetic expression?
80 – 3 * 12 + 21 / 3
A) 315
B) 37
C) 47
D) 24
E) None of the Above
Question 4
What
is the value of the following arithmetic expression?
19%3
A) 3
B) 2
C) 1
D) 0
E) None of the Above
Question 5
What is the value of the following arithmetic expression?
20 + 21 / (24 + 8 % 3)
A) 27
B) 23
C) 10
D) 5
E) None of the Above
Question 6
Which of the following is not a relational operation?
Question 7
Which of the following expressions evaluates to a random integer in between 10 and 15, inclusive?
A) rand()%15
B) rand()%10
C) rand()%6+10
D) rand()%15+10
E) None of the Above
1) D) printf("Winter is coming."); 2) A) %c 3) E) None of the Above (51) 4) C) 1 5) E) None of the Above (20) 6) A) = 7) C) rand()%6+10
Question 1Which of the following statements is syntactically correct in C? A) print("Winter is coming."); B) printf("Winter "+"is"+”coming.”);...
Question 1 20 pts Indicate whether the following statements are both syntactically and semantically correct when used in conjunction with printf. push format! push $format1 r.) msg1fmt: "ascii "\n%s %d\n" msg1fmt: "asciz "\n%s%d\n"
12. if x = 0x25 then which of the following statements is correct a) if y = x | (1<<1) then y is 0x26 b) if y = x << 1 then y is 0x4A Review questions COMP 2401 Fall 2019 Page 4 of 14 c) if y = x & 0x37 then y is 0x35 d) if y = x | 0x37 then y is 0x35 e) All of the above statements are incorrect 13. What will be the...
Fortran questions a) How many input-output statements were there in original Fortran? b) What was the largest possible statement number? c) What was the purpose of statement numbers? d) In what order would the elements of a 2D array be stored in the object program? e) What would the “arithmetic formula” statement be called today? f) If the variable on the left side of an arithmetic formula is a fixed point, and the expression on the right side evaluates to...
7 - What does the code print to the screen? float x(float) 7/3; printf ( " % .2 f", x); a) 7/3 b) 2.50 c) 2.00 d) None of the above a) TRUE b) FALSE c) TRUEFALSE d) None of the above 8 - What does the code print to the screen? int x3; if (x >31x!-2 printf ("TURE") printf ("FALSE"); 9What does the code print to the screen? a) TRUETRUE b) TRUE c) TRUETRUETRUE d) TRUETRUETRUETRUE e) None of...
10 What does the last printf in this code print to the screen? a)n-7 b)n- 0 c)n--1 d) None of the above 鬐include< stdio. h> int main) int n-0 for (n-7: n<O; n-- printf (n") printf ("n *%d", n); - return 11-What does the code print to the screen? 鬐include< stdio.h> void fun (int) int main) b) 8 d) None of the above fun (3) return void fun (int a) int x-10 while(a !_ 3 x > s} if a...
FORTRAN QUESTIONS: a) How many input-output statements were there in original Fortran? b) What was the largest possible statement number? c) What was the purpose of statement numbers? d) In what order would the elements of a 2D array be stored in the object program? e) What would the ”arithmetic formula” statement be called today? f) If the variable on the left side of an arithmetic formula is a fixed point, and the expression on the right side evaluates to...
C PROGRAMMING Write a printf or scanf statement for each of the following: a) Print unsigned integer 2001 right justified in a 12-digit field with 6 digits. b) Print 3.150 in a 9-digit field with preceding zeros. // part of my answer: Printf(“%09 c) Read a time of the form hh-mm-ss, storing the parts of the time in the integer variables hour, minute and second. Skip the dash (-) in the input stream. Use the assignment suppression character. d)...
For any element in keysList with a value greater than 50. print the corresponding value in itemsList, followed by a comma (no spaces) Ex: If the input is 32 105 101 35 10 20 30 40 the output is 20,30, 1 include <stdio.h> 2 3 int main(void) { 4 const int SIZE LIST - 4 5 int keysList[SIZE LISTI: 6 int itemslist[SIZE_LIST); 7 int 1; 8 9 scanf("%d", &keysList[0]); 10 scanf("%d", &keyslist[1]); 11 scanf("%d", &keysList[2]); 12 scanf("%d", &keysList[]); 13 14...
Please explain answer :D
Question 5 (5 marks] Consider the syntactically correct C code below, which is missing a function print_diagonal include <stdio.h> • typedef int Table(100) (100); */• print diagonal (T, n) . Given a Table T, which will have n rows and n columns, print all of the 1 entries on the main diagonal of T (that is, entries whose row number and column number are equal). Remember to print a newline at the end. / ► /...
Consider the syntactically correct C code below, which is missing a function copy_positive. #include <stdio.h> /* copy_positive(A, Aout, size) * Given an array A, which will have the provided size, copy all positive * (non-negative/non-zero) elements of A into the provided output array Aout. * Return the size of the resulting array. */ /* (your code from below would be placed here) */ void print_array(int arr[], int n){ for( int i = 0; i < n; i++ ) printf("%d ",...