GMT: Thứ Ba, ngày 23  tháng 7, năm 2019 . .   
Đăng nhập tạm thời:  

Căn Bản    Văn Phòng    Hệ Thống - Mạng    Phần Mềm Ứng Dụng    Kỹ thuật số    Lập trình    SQL   
 C#     C++     Visual Basic     Visual Foxpro     C     Java     Pascal     Thiết Kế Web     ASP.NET     XML     CSS     PHP   

Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 54
Is the following declaration acceptable? typedef long no, *ptrtono; no n; ptrtono p; A. Yes B. No..... Is there any difference in the #define and typedef in the following code? typedef char * string_t; #define string_d char *; string_t s1, s2; string_d s3, s4; A. Yes B. No.... Are the properties of i, j and x, y in the following program same? typedef unsigned long int uli; uli i, j; unsigned long int x, y; ....
Thời gian bắt đầu: Hôm nay lúc 19:16:26(Server time)
Số câu hỏi: 10.   Tổng điểm: 10
Thời gian làm bài: 20 phút.  Thời gian còn lại: 
Cỡ chữ câu hỏi:  Cỡ chữ đáp án:
1-
Is the following declaration acceptable?
typedef long no, *ptrtono;
no n;
ptrtono p;
A-
Yes
B-
No
2-
Is there any difference in the #define and typedef in the following code?
typedef char * string_t;
#define string_d char *;
string_t s1, s2;
string_d s3, s4;
A-
Yes
B-
No
3-
Are the properties of i, j and x, y in the following program same?
typedef unsigned long int uli;
uli i, j;
unsigned long int x, y;
A-
Yes
B-
No
4-
typedef's have the advantage that they obey scope rules, that is they can be declared local to a function or a block whereas #define's always have a global effect.
A-
Yes
B-
No
5-
What will be the output of the program?
#include<stdio.h>

int main()
{
    int y=128;
    const int x=y;
    printf("%d\n", x);
    return 0;
}
A-
128
B-
Garbage value
C-
Error
D-
0
6-
What will be the output of the program?
#include<stdio.h>
#include<stdlib.h>

union employee
{
    char name[15];
    int age;
    float salary;
};
const union employee e1;

int main()
{
    strcpy(e1.name, "K");
    printf("%s %d %f", e1.name, e1.age, e1.salary);
    return 0;
}
A-
Error: RValue required
B-
Error: cannot convert from 'const int *' to 'int *const'
C-
Error: LValue required in strcpy
D-
No error
7-
What will be the output of the program?
#include<stdio.h>
int fun(int **ptr);

int main()
{
    int i=10;
    const int *ptr = &i;
    fun(&ptr);
    return 0;
}
int fun(int **ptr)
{
    int j = 223;
    int *temp = &j;
    printf("Before changing ptr = %5x\n", *ptr);
    const *ptr = temp;
    printf("After changing ptr = %5x\n", *ptr);
    return 0;
}
A-
Address of i
Address of j
B-
10
223
C-
Error: cannot convert parameter 1 from 'const int **' to 'int **'
D-
Garbage value
8-
What will be the output of the program?
#include<stdio.h>

int main()
{
    const int x=5;
    const int *ptrx;
    ptrx = &x;
    *ptrx = 10;
    printf("%d\n", x);
    return 0;
}
A-
5
B-
10
C-
Error
D-
Garbage value
9-
What will be the output of the program in Turbo C?
#include<stdio.h>
int fun(int **ptr);

int main()
{
    int i=10, j=20;
    const int *ptr = &i;
    printf(" i = %5X", ptr);
    printf(" ptr = %d", *ptr);
    ptr = &j;
    printf(" j = %5X", ptr);
    printf(" ptr = %d", *ptr);
    return 0;
}
A-
i= FFE2 ptr=12 j=FFE4 ptr=24
B-
i= FFE4 ptr=10 j=FFE2 ptr=20
C-
i= FFE0 ptr=20 j=FFE1 ptr=30
D-
Garbage value
10-
What will be the output of the program?
#include<stdio.h>

int main()
{
    const char *s = "";
    char str[] = "Hello";
    s = str;
    while(*s)
        printf("%c", *s++);

    return 0;
}
A-
Error
B-
H
C-
Hello
D-
Hel
[ Thành Lãm - ST ]

Chia sẻ trên Facebook   Google Boomarks   Google Buzz    Xem: 1059. Đăng: 15-09-2012.   

Support Link:
Thông tin trang Web. Online since: 2011.
Disclaimer of Liability and Endorsement:
free counters
VNEDU.ORG IS A NON-PROFIT WEBSITE! All contents throughout this website are from Internet and other sources and are posted by users, copyright belongs to its original author. VNEDU.ORG stores for educational purpose only. VNEDU.ORG resumes no responsibility and liability, make no promise, or guarantee for the accuracy or efficiency of any content. If you find any content that is in violation of copyright laws, please notify us and we will immediately remove them. Thank you for visiting VNEDU.ORG