Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

CNIT 105 MIDTERM QUESTIONS & ANSWERS

Rating
-
Sold
-
Pages
5
Grade
A+
Uploaded on
24-01-2026
Written in
2025/2026

CNIT 105 MIDTERM QUESTIONS & ANSWERS

Institution
Course

Content preview

CNIT 105 MIDTERM QUESTIONS & ANSWERS


What is the extension of the source file of a 'C' program? - Answers -.c

Which of the following is the standard way to scan a float variable x? float x;
scanf("%f", x);
scanf("%.2f", &x);
scanf("%f", &x);
scanf("%d", &x); - Answers -scanf("%f", &x);

Which of the following is the standard way to print a character variable c: char c = 'C';
printf("%d", c);
printf("%c", c);
printf("%c", &c);
printf("%s", c); - Answers -printf("%c", c);

In a C program, the execution begins with which functions? - Answers -main() function

When you don't want the function to return anything, which of the following return types
will you use? - Answers -void()

Which of the following options is a prototype of the given function?int divide(int a, int b){
return a / b;
}
int divide(a, b);
int divide(int, int);
void divide(int a, int b);
int divide(); - Answers -Int divide(int, int);

Identify the problem in the following code
float compute(int a, int b){
float answer; answer = a / b;
} - Answers -Function doesn't return anything

How many times will the loop in the following code run
int main(){
int n = 1;
int sum = 0;
while(n <= 10){
sum = sum + n;
}
printf("Sum of numbers from 1 to 10 is: %d", sum);} - Answers -The loop will run
infinitely many times

, What is the scope of a variable? - Answers -It is the segment of the code where the
variable can be used

What will be the output of the following code
int n; for (n = 1; n <= 10; n++)
{
printf ("%d ", n);
} - Answers -1 2 3 4 5 6 7 8 9 10

What is the scope of the variables a and b in the given function:
float multiply(int a, int b)
{
return a * b;
} - Answers -Only function compute

What is the return type of the following function prototype:
int myFunction(char c, float f, double d); - Answers -Int

What will be the output of the following code segment:
int num = 1;
while (num <= 5)
{
printf("%d, ", (num*num));
num++;
} - Answers -1,4,9,16,25

Which of the following is a valid invocation for the function myFunction():
void myFunction(){ printf("CNIT105 is awesome");}
myFunction();
myFunction;
myFunction("CNIT105 is awesome");
None of the above - Answers -myFunction();

What is the output of the following code segment:
int n = 100;
do {
printf ("%d \n", n);
n = n + 5;
} while (n <= 10); - Answers -100

What will be the output of the following code segment:
int counter = 1;
while (counter <= 99)
{counter++;}
printf("%d", counter) - Answers -100

Written for

Course

Document information

Uploaded on
January 24, 2026
Number of pages
5
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$12.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GEEKA YALA UNIVERSITY
Follow You need to be logged in order to follow users or courses
Sold
2107
Member since
4 year
Number of followers
1446
Documents
53920
Last sold
17 hours ago

3.8

358 reviews

5
177
4
61
3
48
2
17
1
55

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions