CMDP2063 Unix and C Programming

CMDP2063 Unix and C Programming

University

15 Qs

quiz-placeholder

Similar activities

Titanic Challenge

Titanic Challenge

University

16 Qs

CHAPTER 3: SYSTEM ANALYSIS AND DESIGN

CHAPTER 3: SYSTEM ANALYSIS AND DESIGN

University

19 Qs

Emerging Technologies

Emerging Technologies

University

20 Qs

Computer Network and Wireless Network

Computer Network and Wireless Network

7th Grade - University

18 Qs

Quiz 1 | Information Security | Kali Linux Commands

Quiz 1 | Information Security | Kali Linux Commands

University

20 Qs

Quiz KTI

Quiz KTI

University

20 Qs

HCI GOMS quiz

HCI GOMS quiz

University

15 Qs

ViewSonic LCD Training

ViewSonic LCD Training

12th Grade - University

15 Qs

CMDP2063 Unix and C Programming

CMDP2063 Unix and C Programming

Assessment

Quiz

Information Technology (IT)

University

Practice Problem

Medium

Created by

Hanley Fong

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax for a block comment in C?

// Being weak is nothing to be ashamed of. Staying weak is.

<!-- Being weak is nothing to be ashamed of. Staying weak is. -->

/* Being weak is nothing to be ashamed of. Staying weak is. */

#Being weak is nothing to be ashamed of. Staying weak is.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you try to use a // comment in C89?

The code will compile successfully.

It will cause a syntax error.

The comment will be ignored, and the code will run normally.

The // will be treated like a block comment.

Answer explanation

In C89 (also known as ANSI C), the // syntax for single-line comments is not supported. C89 only supports comments that are enclosed in /* ... */ for both single-line and multi-line comments. Using // in C89 will result in a syntax error because the compiler does not recognize it as valid comment syntax. Single-line comments using // were introduced in C99.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What will be the output of the following C program?

No output

Answer explanation

In this program, the for loop iterates with i starting from 0 and increments until i is less than 5.

Inside the loop:

  • When i is 3, the if (i == 3) condition is true, and the break statement is executed, which immediately exits the loop.

  • Therefore, only the values 0, 1, and 2 are printed before the loop is terminated.

So, the output is 0 1 2.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What happens in this program when the square() function is called?

Compile Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following format specifiers is used to print a floating-point value using printf()?

%f

%d

%c

%s

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What is the output of the following program in the image when using printf()?

I have been learning %c for %d %s.

I have been learning c for %d days.

I have been learning for 42 days.

I have been learning C for 42 days.

Answer explanation

Explanation: The printf() function uses format specifiers to insert the values:

  • - %c is replaced by 'C'

  • - %d is replaced by 42

  • - %s is replaced by "days"

So, the final output is: "I have been learning C for 42 days."

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the benefit of using forward declarations in C?

To reduce the size of the executable file

To allow the use of functions before they are defined in the source code

To enhance the readability of the code

To automatically generate documentation

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?