CS1412 Final
CS1412 Final Exam Quiz
Welcome to the CS1412 Final Exam Quiz! This quiz is designed to test your knowledge of C programming fundamentals, including syntax, data structures, and control statements.
Prepare yourself with the following:
- 48 engaging multiple-choice questions
- Instant feedback on your answers
- Ideal for students and programming enthusiasts
GCC is one of the most popular C compilers.
True
False
Usually, directives are at the bottom of a C program
True
False
By default, directives are one line long; there’s no semicolon or other special marker at the end
True
False
\n” is a tab operator.
True
False
The “\{ letter}”(backslash with a letter) code that is used in format strings is called an escape sequence
True
False
Output of printf("\\") will be \\
True
False
In the expression (a+b)*(c-d) we don’t know whether (a+b)will be evaluated before (c-d).
True
False
In the expression below the value of c will be 6. a = 5; c = (b = a + 2) -(a = 1);
True
False
The expression I < j < k is testing whether j lies between I and k
True
False
The operands && and ||are left associative.
True
False
. A _Bool variable can only be assigned
One value
Two value
Three values
Five values
For logical operators “short-circuit” evaluation on two operands means
They first evaluate the right operand, then the left one. If the value of the expression can be deduced from the right operand alone, the left operand isn’t evaluated.
They first evaluate the left operand, then the right one. If the value of the expression can be deduced from the left operand alone, the right operand isn’t evaluated.
They will not perform any operation before the next statement.
They will evaluate both operands together.
For nested loop statements break statement can escape
Only one level of nesting.
Can’t escape any loop
Can escape all of the loops.
Terminate the program.
The goto statement can
Jump nested loop
Jump only two statements
Can jump outside of the program
Print multiple line statements.
Which loop first performs the operation and then tests the condition?
While
Do while
For
All
The code ‘for (;;)’ represents a for loop. You can terminate this loop by:
Break
Return 0
All of the above
You cannot terminate the loop
Which function allocates dynamic memory and initializes all zeros?
Malloc
Calloc
Realloc
To declare a linked list node what is must?
An integer type data
A pointer to next node
A double type data
All of the above
What are the steps involving creating a linked list?
1. Create a node 2. Insert the node in the list
1. Allocate memory for the node. 2. Store data in the node. 3. Insert the node into the list
1. Allocate memory for data 2. Allocate memory for the pointer 3. Add the pointer and data to a single node 4. Insert node into the list
The statement new_node->value = 10; is same as
*new_node.value=10;
(*new_node).value=10;
*(new_node.value)=10;
New_node.value=10;
If you want to delete a node from a linked list what is the first step?
Locate the node to be deleted.
Alter the previous node so that it “bypasses” the deleted node.
Call free to reclaim the space occupied by the deleted node.
None of the above
What will be the prototype of the function named integrate that integrates a mathematical function f between the limit a and b.
Double integrate(double *f(double), double a, double b);
Double integrate (double (*f)(*double), double a, double b);
Double integrate (double f(*double), double a, double b);
Double integrate (double (*f)(double), double a, double b);
The last node of a linked list will point to
First node of a linked list
Null pointer
Garbage
Unknown
In a recursive function if you don’t put a termination condition what will happen?
The recursion will stop early
Infinite recursion
The recursion won’t even start
Structure is like an array you can’t use assignment operator (=) for structure initialization (like if part1 and part2 two structure of the same type. You can’t use part2=part1 for initialization)
True
False
To define a new structure type, we use structype keyword.
True
False
Functions may have structures as arguments but can’t have return values
True
False
Initializing an array of structures is done in much the same way as initializing a multidimensional array.
True
False
The members of an union are stored at different memory addresses.
True
False
Changing one member of a union alters any value previously stored in any of the other members.
True
False
Only the last member of a union can be given an initial value.
True
False
Enumeration is a special kind of type designed specifically for variables that have a small number of possible values
True
False
To declare an enumeration, you have to use pseudonym keyword
True
False
. C supports only three forms of pointer arithmetic.
True
False
Pointers can’t be compared using the equality operators (== and !=).
True
False
You can subtract pointers even both points to elements of the different array.
True
False
It’s not legal for a pointer to point to an element within an array created by a compound literal.
True
False
In general, a+i is the same as &a[i]. Both represent a pointer to element I of a.
True
False
When an ordinary variable is passed to a function, its value is copied; an array is also copied the same way when it is used as an argument and passed to a function.
True
False
The elements of an array of length n are indexed from 0 to n+1.
True
False
You can’t use a sizeof operator to determine the size of an array.
True
False
For array initialization you can use a square brackets ([]),like below int a[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
True
False
. If an initializer is present, the length of the array may be omitted.
True
False
If int a[15] = {[2] = 29, [9] = 7, [14] = 48}; the value of a[5] will be 29.
True
False
The body of a function whose return type is void (a “void function”) can be empty.
True
False
Parentheses of a function is not necessary for function calling.
True
False
In the Quicksort algorithm (discussed in the class) the partition element will divide the total array in
3 partitions
2 partitions
4 partitions
No partition is not fixed
In the Quicksort example (discussed in class) we used
Recursion
Loop method
Recursion and loop both
{"name":"CS1412 Final", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Welcome to the CS1412 Final Exam Quiz! This quiz is designed to test your knowledge of C programming fundamentals, including syntax, data structures, and control statements.Prepare yourself with the following:48 engaging multiple-choice questionsInstant feedback on your answersIdeal for students and programming enthusiasts","img":"https:/images/course5.png"}
More Quizzes
STUCTURED PROGRAMMING CAT
9425
2.3Q - Classes Part II - Quiz
8427
C
1050
Java
1059
C
1050
Data Structure
13613
Stacks and Queues
5245
Python Introduction/Algorithms Quiz
10518
Data Structure
10523
COMP 1 Last Section of Exam Review
11635
Quiz # 01 _ DS&A _ Spring 2020 _ By Engr. Ahmad
12612
😈😈C PROGRAMMING QUIZ -1😈😈
1050