COP1220 Exam Questions With Verified And Updated Solutions.
COP1220 Exam Questions With Verified And Updated Solutions. Given char x, which reads an input character into x? a. scanf("%c", &x); b. scanf("%s", x); c. scanf("%s", &x); d. scanf("%c", x); - answerA What is the ending value of w? int w; int y; y = 34; w = y % 5; a.1 b.4 c.6 d.7 - answerB Which is not a valid identifier? Name _name c.1stName 1 - answerC What is the ending value of y? int x; int y; x = 2; y = ((x + 1) / 5) + (x / 2) ; a.1 b.1.6 c.4.5 d.Error: Division not possible - answerA What is the ending value of z? int x = 5; int y = 12; double z; z = (double)(y / x); a.0.0 b.2.0 c.2.4 d.3.0 - answerB Which is correct? area = 3.2; b.500 = int distance; changeAmt = -321; d.212 = length; - answerC myString is declared as a string and is the only variable declared. Which is a valid assignment? String[] = 'Hello'; String = ["Hey"]; String[] = "H"; String = [Hoy]; - answerC Given char x and char z, which assigns x with the character value held in z? a.x = 'z'; b.x = "z"; c.x = z; d.'x' = 'z'; - answerC Which prints a percent sign? f("%"); f("%%"); f("%"); f('%'); - answerB myChar is a character variable and is the only declared variable. Which assignment is valid? Char = 't'; Char = "t"; Char = t; Char = 'tx'; - answerA What is the ending value of z? x = 0; y = 3; z = pow(x + 2, y); a.0 b.4 c.8 d.Error: Cannot have an expression within a function call - answerC Which identifier name shows good practice? a.m_v PhyMgt _of_shipping_furniture_crates_by_sea OfBox - answerD Which is not true? a.A variable declaration requires a name and memory location
Written for
- Institution
- COP1220
- Course
- COP1220
Document information
- Uploaded on
- June 25, 2024
- Number of pages
- 19
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
cop1220 exam questions with verified and updated s