Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The default case in a switch statement: Select one: Can be anywhere in the switch statement and is optional O b. Must be at the
The default case in a switch statement: Select one: Can be anywhere in the switch statement and is optional O b. Must be at the beginning. O c. Must be at the end. O d. Must be included but can be anywhere. When execution leaves a function i.e. the function returns, any local variables in that function: Select one: O a. are passed back to main O b. are destroyed. O c. are reset to zero O d. keep there values until the next function call Parameter variables: Select one: O a. must have the same name as some variables in main O b. need to be declared again inside the function after the curly bracket. O c. are the same as ordinary variables except that they get their initial values from the function call. are not real variables and should not be used in the code of the fuction When you see an & in front of a variable name, e.g. &x, this should be "read" as: Select one: O a. the address of the thing pointed to by x. O b. the thing pointed to by x. O c. pointer x. O d. the address of x. The following line of code int a, b; - Select one: O Creates 2 integer variables which contain nothing - i.e. zero. O Creates a variable called 'a' and puts the letter 'b' in it. O Declares (creates) the letters 'a' and 'b' Declares (creates) 2 integer variables which contain random numbers. O Creates two variables - one containing the letter 'a' and one containing the letter 'b' The minimum and maximum values a signed char variable can hold are: Select one: O -128 and +127 O 0 and 255 0 -128 and +128 O'z' and 'a' O -127 and +128 Assuming that: a is an int contianing 11 b is an int contining 4 cis an uninitializeddouble 3 of the lines of code below would result in 2.75 being stored in c. However, one lines of code below results in 2.0 being stored in c. Which one is it? Select one: O a. c = a/(double)b; O b. C = (double)(a / b); O c. C= = (double)a / b; O d. c = (double)a / (double)b; Which of the following correctly completes the following statement: A function prototype... Select one: O a. tells the compiler how the function works. O b. must be present or else the code will not compile. O c. is only needed to help the programmer understand wha the function does. O d. tells the compiler what the return type of the function is, how many parameters it needs and what type they are. A variable declared in a function: Select one: O a. can be used in another function but you have to declare it in the other function too. O b. can only be used in that function. can be used in any function O d. can only be used in that function and in main. C. Given the following code and assuming variable x is stored at memory location 0x1234, what will be printed on screen? int x = 3; int *ptr; printf("%p", ptr); Select one: O a. Ox1234 O b. A random number (address) O c. NULL O d. 3 Given the following code: struct Date { int day; int month; int year; }; struct Person { char name [20]; struct Date dob; } struct Person pl; How would you set the day member of the dob member of p1 to a 3? Select one: O a. p1.dob.day = 3; O b. p1.day = 3; O c. p1.day.dob = 3; O d. dob.day = 3; = = In C the variable types that can hold an integer are: Select one: o char, short int, int and long int O short int and int O short int, int and long int O int and long int O int At the end of the main function there is usually the line: return 0; The purpose of this line is: Select one: O To return a code to the operating system to inform it whether or not the program ran successfully. O To tell the user that the program successfully or not. O To return the answer of the program. O To finish the program. Only one of the following values is false in C. Whaich one is it? Select one: : 0 -0.000001 0 0.0 0 -1 O 3 O 0.000001 O 1024 O-999 0 -0.1 A switch statement can be a more efficient way to write: Select one: A series of if, else if, else if..... else statements O b. A series of if statements. OC. A single if statement O d. A single if, else if, else statement. If a function returns a value e.g. int myFunction (void); Select one: a. you must use the returned value or the code will not compile. O b. you may either use the return value or just ignore it as required. O c. if you don't use the return value it will be there the next time you call the function. O d. if you use the return value once you must use it every time you call the function again later in the code. Global variables are: Select one: O a. declared inside main and can be used by any function O b. must be declared in every function that uses them O C. declared outside any function but can only be used in main O d. declared outside any function but can't be used in main e. declared outside main and can be used by any function The following line of code declares a pointer: char *myCharPointer; What can be stored in the pointer variable? Select one: : O 1. the addres of a char variable. O 2. the address of an int O 3. any number O 4. any address The following code has a problem in it. What is it? float myVar = 10; int *ptr = &myVar; printf("The contents of myvar is: %f", *ptr); Select one: O a. It should be "myVar" being printed in the printf statement instead of "*ptr". O b. You cannot assign the address of a float to an int pointer. O C. The pointer should be initialised with NULL. O d. You should use %p when printing with a pointer. How many struct Measurement variables are defined in the following statement? What are their names? What are their types? struct Measurement { int t; float val; } ml, m2, merr
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started