• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 20 pages
Exam (elaborations)

CSCI-0046 Systems Programming in Linux – MIDTERM Questions With Complete Solutions

Document preview thumbnail
Preview 3 out of 20 pages

CSCI-0046 Systems Programming in Linux – MIDTERM Questions With Complete Solutions

Content preview

CSCI-0046 Systems Programming in Linux – MIDTERM
Questions With Complete Solutions

! operator Correct Answer returns TRUE when condition is
FALSE and returns FALSE when condition is TRUE. So the
opposite of the condition.

// Jack wrote a function to increment the value of x. But he is
using a pointer as the parameter
// Which statement inside the function will do the job of
incrementing .
int func ( int *x )
{
// which is statement is valid ?

// statement 1 :
*x++ ;

// statement 2
* ( x++ ) ;

// statement 3
( *x ) ++ ;
}
main ( )
{
int x = 10 ;
func ( &x ) ;
printf ( " x = %d \n " x );

} Correct Answer statement 3

,&& (AND) Operator Correct Answer returns TRUE when
ALL the conditions under consideration are true and returns
FALSE when any ONE or MORE than one condition is false.

#include <stdio.h>
int main ( )
{
int x = 10;
switch x
{
case 10 :
printf ( "Yes" );
break ;
}

}

// The above code compiles fine. True or False Correct Answer
False- Yes, there should be ( ) around x in the switch statement

all data cells in this array will have a value of 4
int data [ 6 ] = { 4 } ; Correct Answer False

Cells in an array are contiguous Correct Answer True

char data [ 2 ] [ 3 ] = { { 2, 3 , 0} , { 1 , 4, 5 } } ;
int i ;
for ( i = 0 ; i < 3 ; i++ )printf ( "%d ", data [ 1 ] [ i ] );

The above code would print Correct Answer 1 4 5

, How to declare an array-1D? Correct Answer dataType
arrayName[arraySize];

How to define a pointer variable? Correct Answer int *ptr ;

ptr is now a pointer variable

if ( -10 )
printf ( "Yes \n" );
else
printf ( "No\n");

The above statement would print Yes.
True or False Correct Answer True

if ( 0 )
printf ( "Yes \n" );
else
printf ( "No\n");

The above statement would print Yes.
True or False Correct Answer False

int * ptr = 20 ;
int y = *ptr ;
The above statement WILL give you run-time error
TRUE OR FALSE Correct Answer True - Yes,
ptr = 20 is illegal because you are assigning 20 (a address
somewhere in the kernel ) to ptr. When you access the value

Document information

Uploaded on
November 2, 2024
Number of pages
20
Written in
2024/2025
Type
Exam (elaborations)
Contains
Unknown
$13.49

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

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.
Classroom
4.0
(1213)
Sold
5020
Followers
3246
Items
56782
Last sold
1 day ago



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